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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.