cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sash
Frequent Visitor

Stacked column chart: Sort legend by value, not alphabet

Hi,

 

Is there any way of configuring the stacked column chart to sort the stacked groups by value and not by alphabet? 

 

I've found a similar question and a solution here (using the group names and prefixing them; like 1_name, 2_name, etc.): https://community.powerbi.com/t5/Desktop/Modify-the-legend-order/td-p/25337. However, in my case I don't want to define the order myself, I want it to be dynamically sorted based on the value of the measure (highest value on the top). 

 

Here is an example of what I want to achieve:

 

example_stackedcolumnchart.png

 

 

 

1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft
Microsoft

@sash

 

If you have only one category on X-axis, you can have your Legend column sort by Value column.

 

Capture.PNG

 

If you have multiple catgories on X-axis, this method will not work. You have to manually define the order column in your table. 

 

66.PNG

Regards,

View solution in original post

3 REPLIES 3
v-sihou-msft
Microsoft
Microsoft

@sash

 

If you have only one category on X-axis, you can have your Legend column sort by Value column.

 

Capture.PNG

 

If you have multiple catgories on X-axis, this method will not work. You have to manually define the order column in your table. 

 

66.PNG

Regards,

On multiple categories x-axis, while preserving the x-axis sort order, I would like to sort the stacked column by value, not alphabet. And doing this dynamically. Any pointer on what calculated column / measure / DAX to do this, rather than manually define the sort order for each x-axis category?

Welcome to the world of Power BI!

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors