Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
ShivGC
Helper I
Helper I

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:

 

ShivGC_0-1738164013716.jpeg

 

 

Therefor the visual looks like this:

 

ShivGC_1-1738164013717.jpeg

 

I'd like it so that the most recent year shows first! Like this:

 

image.png

 

 

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.

1 ACCEPTED SOLUTION
ShivGC
Helper I
Helper 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!

View solution in original post

6 REPLIES 6
ShivGC
Helper I
Helper 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!

MattiaFratello
Resolver IV
Resolver IV

Hi @ShivGC,

 

The power query option seems to be working for me.

MattiaFratello_0-1738164999656.png

MattiaFratello_1-1738165015747.png

MattiaFratello_2-1738165049797.png

Did I answer your question? Mark my post as a solution!

 

This does not work for me. I have tried and tried again!

Syk
Super User
Super User

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-...

 

As for the actual solution... I just created a new column and multiplied the aforementioned column by negative one to flip the order

Syk_0-1738164657511.png

Then you can sort the year column by this new calculated column.

Syk_1-1738164720432.png

 

And your years should be in reverse order!

Syk_2-1738164752821.png

 

where did you create the offset? This seems to be the solution of sorting by a different column. 

Create a date table for your data model. There's a script and video in the link I posted on how to do it and why it's helpful.

Helpful resources

Announcements