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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
cbschley
Helper III
Helper III

Sorting by Legend and Measure at the same time

Hi all, I've searched high & low and unable to find a solution to this.

 

What I am trying to do is take the chart below, and sort it by the "Health" legend first (this is what the chart shows). Secondly I want it to sort high-to-low within each item in the legend.

As you can see, all of the blue bars are not sorted properly, but the legend is sorted in the correct order.

cbschley_0-1725989167077.png

 

1 ACCEPTED SOLUTION

Hi,

PBI file here.  I sorted the table first (as described above) and then created a copy of the table.  I then converted the table into a clustered column chart.  Apply conditional formatting on the chart.

Hope this helps.

Ashish_Mathur_0-1726272173702.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

11 REPLIES 11
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ritaf1983
Super User
Super User

Hi @cbschley 
Please apply the following steps :
1. Switch on sort by values from layout:

Ritaf1983_0-1726019213286.png

2. You have 2 sorting options in the graph 
a. sort axis :

Ritaf1983_1-1726019282136.png

b. sorting legend:

Ritaf1983_2-1726019333907.png

Result 

Ritaf1983_3-1726019537444.png

The pbix is attached

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

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

Hi @Ritaf1983 , When I select "sort by values", it doesn't seem to do anything to the visual. I do see the multiple options of "sort by" in the options, but nothing seems to allow me to sort by "Health" first, then "Values" high-to-low.

cbschley_0-1726067300104.png

 

 

Sorting selected:

cbschley_1-1726067329623.png

 

cbschley_2-1726067346273.png



Hi @cbschley 

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  

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

here's a link with the PBIX file and the visual in question:

https://drive.google.com/file/d/1gKdnAhlLS8zFkHlcpLVztys8j0TG8aMv/view?usp=drive_link 

 

Ideal state would be for it to sort the "Health" buckets from Excess -> healthy -> below ss -> out of stock. From there, each of those "health" categories should then be sorted high-to-low for the values within that bucket. 

Hi,

Unable to open the file.  See attached picture.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi sorry for the trouble. That original file was connected to a semantic model in our service. Try this one instead, which has everything stored within the PBIX.

https://drive.google.com/file/d/1Ec3sOa8j99gclREc0n2kOxaWTySFR6HX/view?usp=sharing 

Hi,

I converted the visual to a Table and sorted the Health and Value fields in ascending and descending order respectively (by holding the Shift key).  I then created a clustered column chart.

Ashish_Mathur_0-1726185076341.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur  this is exactly what I was looking for! 

When I try it on my end though, after I do the sorting step within the table format, I change it back to a clustered-column chart and it does not retain the sorting. Would you know how I can force it to retain the sorting order?

Would you be able to upload your PBIX file that you modified?

Hi,

PBI file here.  I sorted the table first (as described above) and then created a copy of the table.  I then converted the table into a clustered column chart.  Apply conditional formatting on the chart.

Hope this helps.

Ashish_Mathur_0-1726272173702.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @cbschley 
Please refer to the linked discussion, the sorting inside the hierarchy in graphs is a known issue.
@Ahmedx  solved it with the dax measures and I suggested other alternative with matrix + bars 
https://community.fabric.microsoft.com/t5/Desktop/Help-Needed-in-Nested-Sorting-for-Hierarchical-Bar...

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

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.