Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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:

Date1.PNGDate2.PNG

 

The axis looks like this:

 

Date3.PNG

Any help on this? Thank you!

2 REPLIES 2
Ashish_Mathur
Super User
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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-lili6-msft
Community Support
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:

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/7162004-default-selected-slicer-or-tile-by-value-configura

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.