Forum Discussion
Matrix multiple Sort columns
- 8 years ago
You may try using ISONORAFTER Function to add a measure.
Measure = VAR e = SELECTEDVALUE ( Table1[Employee] ) VAR c = [TotalCount] VAR t = SUMMARIZE ( ALLSELECTED ( Table1 ), Table1[Employee], Table1[Customer] ) RETURN COUNTROWS ( FILTER ( t, ISONORAFTER ( Table1[Employee], e, DESC, [TotalCount], c, ASC ) ) )
This works well when the matrix only has one row.
But if it has two rows, aka hierarchy matrix, this doesn't work.
You can maintain multiple levels of the hierarchy by converting your Matrix to a Table, then removing your sub-level of the hierarchy from the table, do the multiple sort by steps in the table, convert the table back to a matrix, and finally add back in the sub-level of the hierarchy to the rows of the matrix. This should maintain the sort by order for multiple levels of the row hierarchy.
** Updated the steps for clarity (3/28/2025) **
Step 1: In your Matrix, add a field to the row hierarchy (which you will later remove).
Step 2: Change the Matrix to a Table visual.
Step 3: Sort all the columns you wish to sort, and in the order you wish them to be sorted.
Step 4: Delete the field you previously added in Step 1 from the table.
Step 5: Change the Table back to a Matrix visual.
Step 6: Ensure the right fields are back in the Row hierarchy.
This will maintain your multiple sorted fields within your matrix, even when you expand your row hierarchies.
- AlexanderKais2 years ago
Advocate I
Plase mark this as Solution. That is absolut genious and easier then a compolex measure 😉
- nglenn13 years agoRegular Visitor
this didn't work for me either
- JenJaRu3 years agoRegular Visitor
wow - thank you! this worked perfectly
- mussaenda2 years ago
Community Champion
Goodness! It is now 2024 but this response saved me.
Thanks! 🙂
- mmichaels19701 year agoFrequent Visitor
2025 here.
- Anonymous1 year agoNot applicable
Solved!
- jimgreene1 year ago
Helper I
You are a giant among us. Thank you!
- dapostolop3 months agoRegular Visitor
Amazing, it works!