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
Fiejj
Regular Visitor

Switching columns based on slicer

Hi everyone,

 

I currently have a table called 'Flights', which contains one row per unique flight. The table contains different columns, including 'Origin Airport' and 'Destination Airport'. I would like to create a visualization showing the number of flights (Y-axis) per airport (X-axis). Instead of making two separate visualizations (one for origin airports and one for destination airports), I would like to combine both visualizations and let users decide if they want to see destination or origin airports based on a slicer. This basically means that the X-axis should use a different column based on the slicer selection. I have tried several solutions from both this forum and Google but every case I find seems to be a little bit different...

 

Thanks in advance!

1 ACCEPTED SOLUTION

For the moment, you cannot make dynamic X axis in Power BI because measures are still not accepted as axis (except in scatter charts).

 

You can use this trick though:

You pick a chart (let's say a histogram) with two columns in the X-Axis: The airport origin column and the destination column;Cap Help Airports.PNG

 

And then, you can play with the hierarchy of the graph to switch between origin and destination airports:

Hierarchy.PNG

View solution in original post

4 REPLIES 4
robofski
Resolver II
Resolver II

@Fiejj

This one got my creative side going as I have data like this so I wanted to see if there was a way around the limitation!

By creating summary tables and then using union to join the two summary tables together and a disconnected slicer I was able to achieve something that works!  

Here's the pbix if you'd like to see how I went about it FlightDiary.pbix The data is pretty boring as I tend to flight from and to the same airports but you can see things change for some airports.

For the moment, you cannot make dynamic X axis in Power BI because measures are still not accepted as axis (except in scatter charts).

 

You can use this trick though:

You pick a chart (let's say a histogram) with two columns in the X-Axis: The airport origin column and the destination column;Cap Help Airports.PNG

 

And then, you can play with the hierarchy of the graph to switch between origin and destination airports:

Hierarchy.PNG

Please accept as a solution so the whole community can benefit from our conversation and see it is actually solved 🙂

 

Thanks.

Thanks, this will do for now. If anyone has a solution which allows for a 'real' slicer, please let me know. 🙂

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.