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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
mnhamermesh
Frequent Visitor

Sort Stacked Area Chart by Measure Values

I'm trying to sort a stacked area chart by the field included in the "Values" field.  I've seen posts where people create sort tables with unique values for each item, but I want the sort order to dynamically change with the summarized values being shown on the chart so when a user makes a slicer selection the legend / stacked chart automatically re-sorts to show the highest summarized value on the top of the legend.

 

 

mnhamermesh_0-1629795617483.png 

 

mnhamermesh_3-1629796318469.png

 

I've tried to sort the Legend field by the column included in the values field, but then run into the 'Sort by another column error'. 

 

mnhamermesh_1-1629796189755.png

 

I've seen others create a new table using the DAX Summarize function which mimics a SQL query with fields + summarizations + group by clause, but trying this method I still couldn't get around the sort by another column error.

 

mnhamermesh_4-1629797019423.png

 

Any help is greatly appreciated!

 

2 REPLIES 2
amitchandak
Super User
Super User

@mnhamermesh , Ideally base column and sort should have one- to - one mapping, that will be best. See like that is not the case, there is two sort value for one value.

 

refer I explained that in the video -  How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi,
Thanks for the response, I watched the video but it doesn't solve for my use case.  I tried to add a rankx column to my table but get an error that I cannot compare text values with number.  I need to sort a text column by the summarized values from a number field dynamicallly so not sure a static rank works in this case. This task is super easy to accomplish in Tabelau, suprised it seems so difficult in PBI.

mnhamermesh_0-1629800279744.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.

Top Solution Authors