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

Change the x-axis dynamically

Hi All

I have a Calendar reference table which has dates spanning 100 years.

I am using this to pull back month and year alongside a table with data relating to activity. The graph is using a measure to calculate the number of cases that were open at the end of the month.

 

This is working perfectly for the data that I have - however, the data only runs up to April 2019 - but because I am using the Calendar table to pull back the month and year, the X axis runs on in perpetuity to the end of my 100 years.

 

How can I limit the graph dynamically so that it only shows data up to a given date (in some cases this will be the last day of the previous month, in other cases, it will be the current date. I may also need to show future dates in other graphs in the model.DynamicX.PNG

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

Just add a conditional in your measure formula as below:

For example:

cumulative sum = CALCULATE(SUM(Table2[Qty]),FILTER(ALL('Calendar'),'Calendar'[Date]<=MAX('Calendar'[Date])))
Measure = CALCULATE(SUM(Table2[Qty]),FILTER(ALL('Calendar'),'Calendar'[Date]<=MAX('Calendar'[Date])&&MAX(Table2[Date])>='Calendar'[Date]))

Result:

6.JPG

 

and if you want in some cases to choose, you could refer to this blog add multiple measure for slicer change

Dynamically change the information within a visual via a slicer

https://community.powerbi.com/t5/Community-Blog/Dynamically-change-the-information-within-a-visual-via-a-slicer/ba-p/87027

 

 

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.