Forum Discussion
Previous month selected with interval
- Anonymous3 years ago
Hi jimi123 ,
I created a sample file for your reference.
Sample data:
There's no relationship between the main table and the calendar table.
Create a measure for the visual-level filters.
Measure = var _select=SELECTCOLUMNS('Calendar',"1",'Calendar'[MonthYear]) var _date1= MAXX( FILTER(ALL('Calendar'),'Calendar'[MonthYear] in _select),[Date]) var _datecolumn= SELECTCOLUMNS( FILTER(ALL('Calendar'),'Calendar'[MonthYear] in _select&&YEAR(MAX('Table'[Date]))=YEAR(_date1)&&MONTH(MAX('Table'[Date]))<>MONTH(_date1)),"1",[Date]) return IF(ISFILTERED('Calendar'[MonthYear]),IF( MAX('Table'[Date]) in _datecolumn,1,0),1)Put the measure into the Filters and set up show items when the value is 1.
Here's the result.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi jimi123 I understand you just need data for previous month? If yes your measure should be
CALCULATE(SUM(<your column name for summing>), PREVIOUSMONTH('Calendar'[Date]))
https://learn.microsoft.com/en-us/dax/previousmonth-function-dax
I hope this help