Forum Discussion
Slicer for Last 6 Months
- Anonymous4 years ago
Hi hello_MTC ,
1. Create a table for slicer:
2. Add a flag measure:
Flag = var _diff= DATEDIFF(MAX('Table'[Date]),TODAY(),DAY) return SWITCH(MAX('For Slicer'[Value]),"Last 3 Months", IF(_diff>=0 && _diff<=90,1,0),"Last 6 Months", IF(_diff>=0 && _diff<=180,1,0))3.Apply it to visual-level filter pane:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - Anonymous4 years ago
Hi hello_MTC ,
So it depends on which date you want to be based on.
For example: you could replace TODAY() with MAXX(ALL('Table'),[Date]).
Table = CALENDAR(DATE(2021,9,1),DATE(2022,4,30))Flag = var _maxDate=MAXX(ALL('Table'[Date]),[Date]) // based on the lateset date in Table var _diff= DATEDIFF(MAX('Table'[Date]),_maxDate,DAY) return SWITCH(MAX('For Slicer'[Value]),"Last 3 Months", IF(_diff>=0 && _diff<=90,1,0),"Last 6 Months", IF(_diff>=0 && _diff<=180,1,0))Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi hello_MTC ,
So it depends on which date you want to be based on.
For example: you could replace TODAY() with MAXX(ALL('Table'),[Date]).
Table = CALENDAR(DATE(2021,9,1),DATE(2022,4,30))Flag =
var _maxDate=MAXX(ALL('Table'[Date]),[Date]) // based on the lateset date in Table
var _diff= DATEDIFF(MAX('Table'[Date]),_maxDate,DAY)
return SWITCH(MAX('For Slicer'[Value]),"Last 3 Months", IF(_diff>=0 && _diff<=90,1,0),"Last 6 Months", IF(_diff>=0 && _diff<=180,1,0))
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
It worked and I Accepted as Solution. But something is missing here. The Slicer is not working because it doesn't have any relationship with my other table.
?