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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.