Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi All,
I've search and read tons but can find how to do this. Everything is about sorting on the row or column header or row totals, not the column total values. I'd like to sort the below matrix from highest column total to lowest, left to right. Hard to explain, so here is a picture. Is this possible?
Thanks for any help you can offer.
Terry
Solved! Go to Solution.
Hi, @tbobolz
You can take a try follow steps:
1.calculate the 'Total' directly in fact table
Total = CALCULATE(SUM('Table'[Rxxxx]),ALLEXCEPT('Table','Table'[Hospital]))
2. Create 'Rank' column based on 'Total' filed
Rank = RANKX('Table','Table'[Total],,DESC,Dense) //or asc
3.duplicate your original column 'Hospital'
Hospital_2 = 'Table'[Hospital]
Then sort this new column by calculated column 'Rank'
4. replace your original field 'Hospital' with new field 'Hospital_2' in matrix visual
Please check my sample file for more details.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
why is it this method sorts from left to right when the rank column isn't even used or refereed to in the matrix?.
Because they used the "sort by column" option which happens in the background but affects the visual.
I don't think this is currently possible, at least not where it dynamically resorts depending on slicers/filters.
I could be wrong (someone please correct me if I am) but I can't think of a way to do this other than hacky workarounds.
Thanks, that's what I'm thinking too.
Hi, @tbobolz
You can take a try follow steps:
1.calculate the 'Total' directly in fact table
Total = CALCULATE(SUM('Table'[Rxxxx]),ALLEXCEPT('Table','Table'[Hospital]))
2. Create 'Rank' column based on 'Total' filed
Rank = RANKX('Table','Table'[Total],,DESC,Dense) //or asc
3.duplicate your original column 'Hospital'
Hospital_2 = 'Table'[Hospital]
Then sort this new column by calculated column 'Rank'
4. replace your original field 'Hospital' with new field 'Hospital_2' in matrix visual
Please check my sample file for more details.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This approach works as long as that the ranking is fixed. If filters or slicers are applied to the visual, there's no guarantee that this pre-calculated ranking is still accurate.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!