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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Narukkp
Helper V
Helper V

Dynamic x-axis is not working for Prior year measure when I select x-axis type from slicer.

Hi Team,
Dynamic x-axis is not working for Prior year measure when I select x-axis type from slicer. As per my requirement in Slicer selection I have 3 types-MonthYear,Week,Date. If I selected Week from slicer selection then I required the current year week wise current year mpus and prior year mpus and same way if I select Day from slicer then each date(current year) wise current year mpus,prior year mpus..

Below are the tables and measures

I have Dim_Date(Date,MonthYear,Week) & MPUFact table(Date, Missed_Pickups)

Measures:
CurrentYearMPUs = CALCULATE(SUM(Missed_Pickups[Missed_Pickups]),Missed_Pickups[PY_Flag] = 0) PriorYearMPus=CALCULATE(SUM(Missed_Pickups[Missed_Pickups]),SAMEPERIODLASTYEAR(Dim_Date[Date]))


Please let me know how to achive this requirement if any one having idea

1 ACCEPTED SOLUTION
Narukkp
Helper V
Helper V

Hi,
I got the solution. Using below code working as expected 

PyTrend= If(ISFILTERED(_Axis[Type]),CALCULATE(SUM(Missed_Pickups[Missed_Pickups]),REMOVEFILTERS(_Axis),SAMEPERIODLASTYEAR(Dim_Date[Date])))

View solution in original post

2 REPLIES 2
Narukkp
Helper V
Helper V

Hi,
I got the solution. Using below code working as expected 

PyTrend= If(ISFILTERED(_Axis[Type]),CALCULATE(SUM(Missed_Pickups[Missed_Pickups]),REMOVEFILTERS(_Axis),SAMEPERIODLASTYEAR(Dim_Date[Date])))
amitchandak
Super User
Super User

@Narukkp , if you want to change axis from Week , day, you need boomarks. If you want to change only measure you need measure slicer

 

Axis Slicer
Dynamically change chart axis in Power BI
bookmark -https://blog.crossjoin.co.uk/2018/04/20/dynamically-changing-a-chart-axis-in-power-bi-using-bookmarks-and-buttons/
https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive
https://www.youtube.com/watch?v=6jeSIRpjv0M
https://datamonkeysite.com/2020/10/22/change-dimension-dynamically-using-parameter-in-powerbi/

 

measure slicer
https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/50...
https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...
https://www.youtube.com/watch?v=vlnx7QUVYME

calculation groups
https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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