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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
kopytko95
Frequent Visitor

Dynamic legend on bar chart doesn't sort categories properly when switching between selections

Okay, so i have dynamic legend with three columns/categories (one is text, two of them are numbers, 0-10 and 1-16 respectively and they have their own tables). There's parameter on the slicer, so whichever category i choose, it's on the Y axis of bar chart.
What is my problem - one of the numeric ones automatically sorts from 0 to 10 from left to right, while the other one autoamtically sorts by values.
I can manually choose to have it sorted by category, ascending instead of values, but when i do the switch on the slicer and switch back, it's again sorted by the values.
What i noticed, is that on the category that works well, when i open sorting menu (three dots -> sort axis), there is no check on neither category nor value, but on the other the check is initially always on values.

Any idea how to fix it? 

2 REPLIES 2
kopytko95
Frequent Visitor

One of the fields was sorted by some other (index) column and worked fine, and the one working badly was sorted by itself only which apparently triggered some switch in there (so the sort everytime was by the value) . I changed the field so it's by default sorted by some other column from the table which caused so it doesnt switch to sorting by value everytime i change selection.

Anonymous
Not applicable

Hi @kopytko95 ,
Based on your description, I can understand that you want to sort a bar chart with a fixed order of x and y axes. In Power bi, the initial sorting of the axes is usually numerical descending and alphabetical descending. If you change the data on an axis, it will be initialized. Also, you can only sort the bars according to one axis, otherwise the other axes will be affected.
You can refer to these two documents
Sort one column by another column in Power BI - Power BI | Microsoft Learn
Change how a chart is sorted in a report - Power BI | Microsoft Learn

Best regards,
Albert He

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.