Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerBI Sort Columns in Matrix Visual

Tags:

I have a Matrix visual in Microsoft PowerBI with Australian 'States' as rows and 'Months Ago' as columns.

By default the Matrix shows my columns from 0 months ago to 12. I would like it to show from 12 months ago on the left to 0 months ago on the right.

+-------------------+-----------------------------+-------+
|                   | Months Ago                  |       |
+-------------------+-----------------------------+-------+
| State             | 0  | 1  | 2  | 3  | 4  | 5  | Total |
+-------------------+----+----+----+----+----+----+-------+
| Queensland        | 10 | 10 | 10 | 10 | 10 | 10 | 60    |
+-------------------+----+----+----+----+----+----+-------+
| New South Wales   |    |    |    |    |    |    |       |
+-------------------+----+----+----+----+----+----+-------+
| Victoria          |    |    |    |    |    |    |       |
+-------------------+----+----+----+----+----+----+-------+
| South Australia   |    |    |    |    |    |    |       |
+-------------------+----+----+----+----+----+----+-------+
| Western Australia |    |    |    |    |    |    |       |
+-------------------+----+----+----+----+----+----+-------+

Currently I am only given the option to sort by the value type fields (ie revenue etc).

Is there any option to sort/order the Column Headers?

like image 393
Jay Killeen Avatar asked Apr 06 '18 03:04

Jay Killeen


People also ask

How do you sort multiple columns in a matrix power bi?

Press Shift + Left Click on the Header Column on which you wish to apply Multiple Sort. Here, we will select the Order Date Column with Shift + Left Click. You can see here, first, it sorts the data based on the Item and then it sorted data based on “Order Date” column.

How do you sort Data in a matrix in power bi?

Click on the Data tab, highlight the row, select the Modeling tab, then "Sort By Column". This will allow you to sort by a different column, such as Account Number.

How do I sort multiple columns in power bi visual?

You can sort multiple columns in a table just by holding the shif key and clicking the column headers you want to sort.


1 Answers

I don't think there is an option for you to sort column headers directly.

However, you can change the default sort order for the Months Ago column so that it will be reflected in general.

You can add a custom column MonthSrt = 12 - [Months Ago] in query editor:

MonthSrt

(It won't work in DAX because of a known issue)

Then you can select the Months Ago column and sort it by MonthSrt:

custom sort

The custom sort will be applied when you use the Months Ago column in visuals:

result

like image 116
Foxan Ng Avatar answered Oct 11 '22 15:10

Foxan Ng