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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. 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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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