Hi All,
How can I use the advanced filter to create a filter to query the last day of last month?
Or, should this be done in a customer filter?
I have a date field and would like to have a relative filter to always filter last day of last month.
Any suggestion is appreciated ๐
Cheers,
Cristian
When you say the last day of the last month, I assume mean the last day of the previous month. The last of the day of the last month could be interpreted as always being December 31st.
A custom filter like the following should do the job:
${your_date_field} = add_days(-1, trunc_months(now()))
Ahh sorry. Of course. I translated from my own language ๐ Youโre right I meant previous month.
Ok, I donโt get this to work but I see that โadd_days(-1,trunc_months(now()))โ gives me exactly the date I want so Iโm doing something wrong.
@cristian2 assume todayโs date `2020-03-04โ
The trunc_months()
function truncates the date to the beginning of that months, which would return 2020-03-01
. For each date it would always return year-month-01
Now you are substracting one day from that date and get 2020-02-29