Forum Discussion
Descending Order
Hey Everybody,
I am trying to put the order of the columns in one of my reports in descending order by YearMonth in a matrix. Right now, it is in ascending order. I have tried using 'Sort by Column', but that only sorts the data in the table component of Power BI, not in the matrix in the UI. Does any one know how to fix this? It seems pretty basic, but it has me stumped 😁
The column titles are, in order, 20202, 20203, 202004, 202005, 202006, 202007, 202008, 202009, 202010.
I want the column titles to be reversed so that 2020010 comes first, then 202009, and so on.
Thanks
Dan
I just got it to work. I had to pull from a new table, join the table, and then it worked... thanks for your help
7 Replies
- AnonymousNot applicable
At the moment Power BI doesn't have the capability to sort the column order of a matrix; only the row order may be sorted.
A simple work around is to add a custom column in data view that reverses all the values and sort by that column.
For example, if I'm currently using [MMM YYY] in my matrix and sorting it by serial month.......then I would add a new column with the following formula.
This gives me a new column that I would then use for the 'Sort by column' option
Which makes my matrix go from this:
To this:
- i820017Resolver II
I switched the sign of the YearMonth column, then I sorted by that new column, and it still didn't work. I am getting this.
- i820017Resolver II
It is still not working. This is what I am getting.
- v-lili6-msftCommunity Support
hi i820017
For your case, you need to use sort by column to get it:
https://radacad.com/sort-by-column-in-power-bi
just create a column as as below:
DescYearMonth = -(YEAR('Date'[Date])*100+MONTH('Date'[Date]))then set sort by column as below:
Result:
and here is sample pbix file, please try it.
Regads,
Lin