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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to sort a date-type slicer in descending order?

I have a column for Cal Year.

 

2014

2015

2016

2017

2018

 

My users want to see this data in a Matrix View sorted in Descending Order.

sort.PNG

 

 

 

 

 

I have created an indexed column, and tried to sort via this.

 

Study Year Desc Sort = RANKX(ALL('Year Descending'[Study Year Desc]),'Year Descending'[Study Year Desc])sort table.PNG

 

 

 

However, when I try and add this to my table and sort by it (so I can have the greatest year on the far left of the matrix). 

I get this error.

sorterror.PNG

There has to be a way right?

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

According to your requirement, I am willing to recommend you several solutions, please take it at your convenient.

One solution is that you need to add an custom column in query editor as follows, then change the data type of each column to whole number.

1.PNG2.PNG

 

Then you could sort your matrix column using this index column.

Select the matrix visual and the ‘year’ in FIELDs pane, then select Modeling>Sort by Column>Custom, finally, you will get the following result.

3.jpg

 

Another is to add a conditional column in query editor, then edit it as follows. Next step is similar to the previous one.

4.PNG

 

If you have any question, please feel free to ask.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

According to your requirement, I am willing to recommend you several solutions, please take it at your convenient.

One solution is that you need to add an custom column in query editor as follows, then change the data type of each column to whole number.

1.PNG2.PNG

 

Then you could sort your matrix column using this index column.

Select the matrix visual and the ‘year’ in FIELDs pane, then select Modeling>Sort by Column>Custom, finally, you will get the following result.

3.jpg

 

Another is to add a conditional column in query editor, then edit it as follows. Next step is similar to the previous one.

4.PNG

 

If you have any question, please feel free to ask.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you, I was missing that data type step to change it to a whole number!!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.