I implemented this solution to create a relative date slicer on my model. However, once I did this, it effectively made all my “previous month” calculations as “blank” when selecting for current month to date.
I’m assuming this is because the slicer filters the previous month out of the date table, and so there is no data available for the DAX measure to reference. I attempted to use functions such as “All”, however, I still couldn’t get my previous month values to populate.
For example, I have the following DAX measure to calculate membership levels:
My “current period” function:
Last MemCnt = IF ( LASTDATE ( Dates[Date] ) >= TODAY (), CALCULATE ( [Avg MemCnt], LASTNONBLANK ( 'Memberships'[date], MAX ( Dates[Date] ) ) ), CALCULATE ( [Avg MemCnt], LASTDATE ( Dates[Date] ) ) )
Previous month function:
Last MemCnt EOLM = CALCULATE ( [Last MemCnt], PREVIOUSMONTH ( Dates[Date] ) )
Can someone please advise?