Forum Discussion
Rolling 12 DAx Measure
I have a date slicer that goes from 12/31/2017-12/31/2019 (Next year Jan it will become 12/31/2017 - 12/31/2020).
I have visuals with the date as axis- But this axis should have only rolling 12 months. Ex: Now we are in July, so the axis would have 6/30/2018 - 6/20/2019. Similarly in August, this axis would be 7/31/2018 - 7/31/2019.
For now i am applying a page level slicer to affect each visual, choosing the dates i want it to be seen. However, it would be easy if i had a dax measure with a yes/no so that I can choose "Yes" in page level filter and next month it would change on its own rather than me doing it manually.
The date table with date slicer look as follows:
The axis looks like this:
Any help on this? Thank you!
2 Replies
- v-lili6-msft
Community Support
hi, Anonymous
You may try to this way:
Add a tag column in date table
tag = IF(DATEDIFF('Date'[Date],TODAY(),MONTH)>=1&&DATEDIFF('Date'[Date],TODAY(),MONTH)<=12,"Yes","No")
Then set filter is "Yes".By the way, dynamic slicer is not available in power bi for now. please refer to this:
Best Regards,
Lin
- Ashish_Mathur
Super User
Hi,
My solution here should get you started - Flex a Pivot Table to show data for x months ended a certain user defined month.
Hope this helps.