Forum Discussion
Measure and sort in matrix
- 1 year ago
You will laugh when I tell you the answer ....
Change the data type from Text to a Number
Text will sort alphabetically and left justify like this.
The promlem will fix itself when you use a number instead of text
Please click thumbs up and accept solution. Thank you !
3
301
32
4
405
43
Hey StuartPQY ,
Thanks for sharing the screenshot and explaining your challenge. It looks like you're using a matrix visual in Power BI, displaying two DAX measures: one for Prior Year Actuals and one for Actuals. You're trying to sort the matrix by one of these measures, but the sorting doesn't work as expected. Let's go over why this might be happening and how to fix it.
There are 3 option to correct sorting
Option 1: Use a Single Dynamic Measure Instead of Two Static Measures
If you're using two separate measures like [Prior Yr Actuals] and [Actuals], consider creating one dynamic measure that returns the correct value based on slicer selections (like year or period offset). This way, you’ll only have one measure in the matrix, which makes sorting much more reliable.
Option 2: Switch to Table Visual Instead of Matrix
If you don't need the row/column hierarchy provided by the matrix visual:
-
Switch to a table visual, which allows sorting directly by measure columns more reliably.
-
Add [Supplier Name], [Prior Yr Actuals], [Actuals] as separate columns.
Option 3: Use a Sort Column
Create a calculated column to help sorting: SortOrder = SELECTEDMEASURE()
Then sort the matrix by that measure, using the Sort Order column (you may need to change visual type or tweak formatting).
For Detailed Information:
https://community.fabric.microsoft.com/t5/Desktop/Sort-Matrix-by-Measure/td-p/142742
https://community.fabric.microsoft.com/t5/Desktop/Sort-Matrix-by-Value-not-working/td-p/417722
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam