Using Multiple Columns to Sort Matrix in Power BI
- Gaurav Dhama
- Nov 13, 2021
- 1 min read
So one of the majorly faced issue while using Power BI matrix visual is the sorting, as matrix only allows sorting by one column, so how can we do that?
So what we can do is, we can add a new column with the concatenation of values that we need to use for sorting say, C1, C2, C3 & C4 are the columns by which we want to sort it. So concatenating them together gives us a unique key. Code will look like this
Unique Key = C1 & C2 & C3 & C4
This unique key can be used as a sorting method for any one of the column using following method.
Select the column from Fields list on the right, then go to column tools tab and under the column tools ribbon we can see an option sort by column, select the unique key. This will arrange the matrix sorting as per the requirement.

The above pic is only for reference of steps.
Please note that the concatenation of columns must in the order of sorting, in our example above, we wanted to sort the matrix first by C1, then by C2 then C3 and C4 creating a hierarchy.
This method is not limited to matrix, it can be used for any kind of visual when required.
Thanks for reading.
If you have any doubt or query, do write back and we will try to SOLVE THAT QUERY.
Comments