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
menezesan
Frequent Visitor

Order a chart by a sum of a category in the legend

Hello, 

 

I need to order my Stacked column chart by the sum of a category in a field and not the count of lines.

 

For example:

I do have 139 issues for GM being 2 of them as red impact

and I have 114 for Risk, being 8 as red impact

 

I need the Risk group be the first one in the chart instead of the GM.

 

Someone knows how to help?

menezesan_0-1716305515595.png

 

1 ACCEPTED SOLUTION
kpost
Super User
Super User

Sounds like you just want to sort it by the sum of "Red".  You'll notice my legend is not sorted the ways yours is, but this should still work for you.

 

See attached .pbix file for an implemented solution.

 

Create a measure like this:

Red = calculate(COALESCE(SUM('Table'[Value]), 0), 'Table'[Impact] = "Red")
Add it as a 'Tooltip' value
red_tooltip.PNG

 

Then sort the visual by that measure, descending.

 

soln.PNG

 

A potentially unwanted side effect is that when you hover on a column, the measure value "Red" value will show up.

 

red.PNG

 

///Mediocre Power BI Advice, but it's free///

 
 

View solution in original post

1 REPLY 1
kpost
Super User
Super User

Sounds like you just want to sort it by the sum of "Red".  You'll notice my legend is not sorted the ways yours is, but this should still work for you.

 

See attached .pbix file for an implemented solution.

 

Create a measure like this:

Red = calculate(COALESCE(SUM('Table'[Value]), 0), 'Table'[Impact] = "Red")
Add it as a 'Tooltip' value
red_tooltip.PNG

 

Then sort the visual by that measure, descending.

 

soln.PNG

 

A potentially unwanted side effect is that when you hover on a column, the measure value "Red" value will show up.

 

red.PNG

 

///Mediocre Power BI Advice, but it's free///

 
 

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.