How to filter for last month 'December' but not a year ago 'December'

I have a slice that filters for all activity created last month. Normally it works, however, this month ‘January’, its picking up last month ‘December 2020’ but also December ‘2019’. How do I include month/year? My slice expression is below:

AND(MONTH([Created Date]) = MONTH(EOMONTH(TODAY(), -1))

AND(
[Created Date] <= EOMONTH(TODAY(), -1) , 
[Created Date] > EOMONTH(TODAY(), -2)
)
4 Likes

For reference:

2 Likes

What’s confusing is that I had EOMONTH - 1 which should be Jan 2021 - one month = Dec 2020 but, instead, it was just calculating that last month was December and, thus, including Dec 2019. Marc’s expression works though. Thanks Marc!

EOMONTH outputs a Date type, not a month. Dates include the year. But then you wrapped it in MONTH(), which just outputs a number 1 through 12, thus stripping the year off.

MONTH() of any Date in Dec 2020 equals 12. Same for any Date in Dec 2019, or 2018, etc.

3 Likes

Oh yeah, not sure why I did that. Thanks for clarifying!

1 Like