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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Custom / dynamic sorting based on slicer value

Hello!

 

I have problem which I don't know how to fix it. I am making report about bus traffic. There are different 6 routes and all of them are using few same bus stops in the middle of the route. I want those stops shown in correct order in Clustered Bar chart based on which of the 6 routes are selected in slicer, and if all is selected then using some "default" sorting order which is somehow correct but can't be absolute correct.

 

There is a picture under this (sorry, it's terrible 😅) to show what I mean.

 

This would be pieace of cake if you could but a measure at the visual axix but that is not allowed. I know how to make basic "index columns" for sorting stuff at Data section and at Query Editor. And then sorting one column based on an other. But problem with in this my case is that there will be duplicates when putting stop_id's and sorting numbers in same columns for all 6 routes. One solution might be to make own columns for each route and their index columns, but I don't know how to "tell" for Bar Chart visual which column it has to use for sorting based on which route is selected for a slicer.

 

Can anyone help me with this please?

 

routes.jpg

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

Could you provide a simple PBIX file for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures. I look forward to your response.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello

 

Thanks for answering. I made a demo pbix for you but I don't know how to send here. But here is two pictures.

First table contains:

 

  • trip_id (connects to route_id in other table)
  • stop_sequence (unique sequence for stopping order per trip and per stop
  • stop_id for every stop
  • direction_label

What I need is to get stop_id's to correct order based on directions stopping sequence. Every direction has own unique stopping sequence. So when I selected "A to B" from slicer stop_id's in bar charts has to get into correct order. When all directions are selected it does not matter in which order stops then are. Only when single direction value is selected.

 

Second table has stop id's, names and correct stop/sort order but it is manually made in excel so it is fixed. I need dynamical sorting based on direction -> trip_id -> stop_sequence.

 

Thanks!

 

trip_stop_sequence.png

stop_fixed_order.png

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.