Showing results for 
Search instead for 
Did you mean: 
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

Community Support
Community Support

Re: Change the x-axis dynamically

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]))




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



Best Regards,


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

New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors