Last day of last month user filter

cristian2
Participant IV

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

0 3 5,674
3 REPLIES 3

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()))

cristian2
Participant IV

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.

Dawid
Participant V

@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

Top Labels in this Space
Top Solution Authors