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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply

Change Y axis based on slicer and/or parameter

Hello everyone!

What I basically want to do is create a dynamic Y axis on a bar chart, where it changes based on a slicer selection or parameter click.
But I need to have two bars per X iteration, 2023 vs 2024.

 

I don't know If you can visualize what I want to do, but I created a mockup on paint since I can't disclose the info on the charts!Mockup.png

1 ACCEPTED SOLUTION

Hi! Just wanted to post here since I figured it out.

 

This is basically what I had, a few indicators as a parameter in Y axis, what I needed is each month to have two columns as years. What i figured was to use my Year column as another X axis. Thanks so much, even though I couldn't quite explain it😅Dashboard example.png

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi Ritaf1983 ,thanks for the quick reply, I'll add more.

Hi @Henrique_Quint ,

Please correct me if I have misunderstood.

The Table data is shown below:

vzhouwenmsft_0-1727674561340.png

Please follow these steps:

1.Manually enter the following data and create table-to-table relationships

vzhouwenmsft_1-1727674703125.png

vzhouwenmsft_2-1727674772291.png

2.Use the following DAX expression to create a measure

Measure = CALCULATE(SUM('Table'[Value]),'Table'[Year] IN VALUES('Table (2)'))

3.Final output

vzhouwenmsft_3-1727675219157.png

vzhouwenmsft_4-1727675234828.png

vzhouwenmsft_5-1727675249252.png

 

Best Regards,
Wenbin Zhou

Ritaf1983
Super User
Super User

Hi @Henrique_Quint 
To get the desired result you should create 2 measures for the current year and the previous :

Ritaf1983_0-1727464605280.png

Or to use the year as a legend and select by filter/slicer the wanted years :

Ritaf1983_1-1727464702374.png

The pbix with the example is attached.
For more specific suggestions:

please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

If my answer was helpful please give me a Kudos and accept as a Solution.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Sorry if I made myself confusing to understand 😅

I have several KPI's (let's call them A, B and C) in measures (each one has one for total, one for 2024 and one for 2023), What I want to do is create a bar chart that has both 2023 and 2024 as Y axis (two columns), months as X axis and some sort of slicer or parameter that changes the Y axis for A, B or C while still keeping 2023 and 2024 as columns in Y axis and months in X axis!

Hi @Henrique_Quint 
The explanation is even more confusing.
Since you're asking a question that is both logical and requires a demonstration, it's essential to ensure that whoever is trying to help can focus on finding a solution, rather than generating data and trying to guess your intent—something that often takes a lot of time, which most of us don’t have. The support here is voluntary, and we genuinely want to help, but time is a limited resource.
Therefore, for these types of questions, to get an accurate solution, it’s recommended to include a sample dataset and a sketch of the desired solution.
If the data is sensitive, you can simply create a file with a similar structure and a few dozen rows, just to give something to work with.
The PBIX file can be stored in a public cloud service, and you can share the link.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi! Just wanted to post here since I figured it out.

 

This is basically what I had, a few indicators as a parameter in Y axis, what I needed is each month to have two columns as years. What i figured was to use my Year column as another X axis. Thanks so much, even though I couldn't quite explain it😅Dashboard example.png

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.

Top Kudoed Authors