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

Sort Matrix Column using measure

Hello,

 

I have a matrix with a date column called "Valuation Date" we want to sort the visiual in descending order(newest date first) instead of the default ascending order. The common solution I know or have found is to use the sort by column under modeling, however this isn't an option for us. We have 1 dataset being shared across multiple reports as a PowerBI Dataset. This eliminates the ability to sort by column on the reports.

 

Is there a way to create a measure which would sort the matrix by the valuation date descending rather than ascending or is the only option to use new dataset?

3 REPLIES 3
Dubs
New Member

I was having the same problem. The workaround seemed to be moving the date from column to rows. Then sort ascending by clicking directly on the date field. Then once it's sorted by row, drag and drop the date dimension back into the columns. It somehow overrides any pre-existing sorting.

 

Hope that works!

v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

I make a test as below:

Connect to a Power BI Dataset with Power BI Desktop,

add "date" to "column" field, it is possible to sort "date" column by descending as below:

sort = RANKX(ALL('Table'),CALCULATE(MAX('Table'[date])),,DESC,Dense)
Capture5.JPG
Then format the measure as below, so that it doesn't show in a matrix
Capture6.JPG
 
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hello @v-juanli-msft ,

 

I tried adding this but it only works if there are no rows in the matrix. If you have any row it will no longer sort by the sort measure.

In the two below screen shots I applied the measure the one without a row works, but when you add any row it will no longer sort.

 

SortnotWorking.PNG

SortWorking.PNG

 

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.