Forum Discussion
Sorting by Column in Matrix Visual
Hi,
I have not found an answer to this specific question, so will post here and hope its a quick fix! Thank you in advance.
I am creating a Power Bi report, and I am using a matrix visual to slice my data.
I am unable to sort my matrix visual by 'Year' Descending which is inputted into the Columns field. As shown in the image below:
Therefor the visual looks like this:
I'd like it so that the most recent year shows first! Like this:
Here are the solutions that I have tried (but have had no success):
1) Sorting the inputted data in Power Query by descending!
2) Adding an additional column in power query, which I use to sort the 'Year' column descending.
It seems you can not order by a date hierarchy! You would have to create a new column that extracts the year from the date hierarchy and sort by this column in descending order!
6 Replies
- SykResident Rockstar
You may need to add a "Year Offset" column in your data that will show how far off the current date your year is. For example the previous year is -1, current year is 0, and next year is 1. I use this date table in most of my reports and it has this column:
https://radacad.com/all-in-one-script-to-create-calendar-table-or-date-dimension-using-dax-in-power-biAs for the actual solution... I just created a new column and multiplied the aforementioned column by negative one to flip the order
Then you can sort the year column by this new calculated column.
And your years should be in reverse order!
- MattiaFratelloSuper User
Hi ShivGC,
The power query option seems to be working for me.
Did I answer your question? Mark my post as a solution!
- ShivGCHelper I
This does not work for me. I have tried and tried again!
- ShivGCHelper I
It seems you can not order by a date hierarchy! You would have to create a new column that extracts the year from the date hierarchy and sort by this column in descending order!