Forum Discussion

cbolling's avatar
cbolling
Icon for Helper I rankHelper I
5 years ago

Create a Rolling Month Filter given a date filter

I have a graph that plots revenue. I need a filter that filters the dates on the graph to show only the current month depending on the selected date. The graph should be a rolling month.

 

If the selected date is March 10, the graph should show March 1-10.

If the selected date is Febraury 28, the graph should show February 1-28.

If the selected date is February 5, the graph should show February 1-5.

 

This is my calculation for the last sale date given the selected date:

TS_LASTSALESDATE2 = CALCULATETABLE ( LASTNONBLANK ( DimDate[DateKey], 0), ALLSELECTED(FactSales))
 
This is my attempt at a filter that didn't work:
Filtered Month = IF(FORMAT(LASTNONBLANK(DimDate[DateKey],0),"YYYYMM")=FORMAT([TS_LASTSALESDATE2],"YYYYMM"),"YES","NO")
 
Appreciate the help!

2 Replies