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
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
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!

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.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.