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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Sort a stacked column chart with the largest bar down (first)

Hello everyone!

As you can see in the attached image, I have this stacked column chart, what I would like to do is sort first as the largest, so the red with 285 would be the base, followed by the blue with 277 ...

orderchart.PNG

It's possible? I've searched some forums, but they talk about creating a measure for each value, but I have almost 11 values.

Best regards

1 REPLY 1
DataZoe
Microsoft Employee
Microsoft Employee

@Anonymous ,

 

Ok  I did find a way, though to be honest it's not very elegant. 

 

DataZoe_2-1606247941799.png

 

The ribbon chart can sort each stack if there is more than one stack, so

 

  1. I created a calculated column in the main table that simply [Column1] = 1, then a table with 1's in the first column (to link to the 1 column) and then 1, 2 in the second column: DataZoe_0-1606246944286.png
  2. I created a relationship on the 1s. ('Ribbon'[Value1] to 'Table'[Column1])
  3. Then I used Value2 on the axis which will then show 2 sorted bars with the same values. 
  4. It sorts by desc, so I created a measure that multipled the desired measure by -1 to have it sort asc.

You now have a couple options for formatting it:

 

  1. Make ribbons transparency = 0 and turn off tooltips. (so you don't get the rank tooltip on the ribbons and the negative numbers showing)
  2. Make ribbons fully transparent = 100, then hide the second stack with a well placed shape. Make sure maintain layer order is on both the chart and shape. Create a tooltip page to replace the default tooltip for the bars to show the number correctly.

I liked option 2 best because there were faint lines visible on option 1 that I couldn't figure out how to get rid of. 

 

You can also create stuff like spacing between the sections which is kind of nice.

 

staked sort.gif

I've attached the PBIX file.

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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