Forum Discussion
Changing sorting in matrix
- 4 years ago
Hi hashtag_pete
Currently it is still not supported to sort by multiple columns in a Matrix visual.
While this is supported in a Table visual. If you can conver the matrix into a table, you can Shift + click the column header you would like to add next in the sort order to add more columns to the sort order. See Power BI Desktop March 2020 Feature Summary - Multi-column sort for tables
I found a solution with DAX in this thread (Matrix multiple Sort columns). You can tweak the measure and add it to the matrix, then sort by this measure column. You will probably hope to hide this measure column but I haven't found a good way to do that.
For the second question, the sorting isn't changed. The highlighted two product rows disappear in the second image because when you have the divide function without -1, it returns blank result for these two products (as their SUM(Sales[Sales Amount]) result is blank). When the function has -1, their results are -100% not blank, so they appear.
If you want to always show rows with blank values, you can right click on Category or Product field and select Show items with no data option. Or you can also add +0 to the function without -1, then blank values will be converted into 0 and appear in the matrix.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi hashtag_pete
I think your idea should work. Anyway try this DAX
Sales Amount vs Extended Amount =
VAR __result = DIVIDE ( SUM ( Sales[Sales Amount] ), SUM ( Sales[Extended Amount] ), 0 )
RETURN
IF ( ISBLANK ( __result ), BLANK (), __result - 1 )
Regards,
Jing
Thanks a lot Jing, made my day!