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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Matrix sorting

Hi, 

I am trying to create a report page which should be dynamic and could be exported as you want.

For that I am using Fields parameter in matrix visual. Client wants to select Product Manager or other and then Date which is basicly YYYY-MM and sort it by Sales as show in picture. The problem is that he would like to sort first row level (Product Manager) and still have the second level (Date 
) in order month by month.

Is there a solution for that? 

Thank you!

example.png

1 ACCEPTED SOLUTION

Hi @Anonymous 

You can try the following measure

Measure 2 = IF(ISINSCOPE('Table'[Column1]),RANKX(FILTER(ALLSELECTED('Table'),[Column3] in VALUES('Table'[Column3])),CALCULATE(SUM([Column1])),,ASC),IF(ISINSCOPE('Table'[Column3]),RANKX(ALLSELECTED('Table'),CALCULATE(MAX('Table'[Column3])),,DESC,Dense)))

vxinruzhumsft_0-1694418251638.png

 

Output

vxinruzhumsft_1-1694418259560.png

 

Best Regards!

Yolo Zhu

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

3 REPLIES 3
v-xinruzhu-msft
Community Support
Community Support

Hi @Anonymous 

Is the following output you want?

vxinruzhumsft_0-1694138285873.png

 

You can create a measure 

e.g 

Measure 2 = IF(ISINSCOPE('Table'[Column1]),RANKX(FILTER(ALLSELECTED('Table'),[Column3] in VALUES('Table'[Column3])),CALCULATE(SUM([Column1])),,ASC),IF(ISINSCOPE('Table'[Column3]),RANKX(ALLSELECTED('Table'),CALCULATE(MAX('Table'[Column3])),,ASC,Dense)))

Then put it to the matrix and select sort by measure2 and ascending

vxinruzhumsft_1-1694138397258.png

 

and if you don't want to show the measure, you can close the text wrap of the column header, then hide the measure.

vxinruzhumsft_2-1694138567667.png

vxinruzhumsft_3-1694138609670.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Anonymous
Not applicable

Looks good and almost what I wanted. 

The only thing is, that I would like to have sorting like in your last picture, when on the top there is the most Sales made Manager (b in your picture) but Dates still goes from lowest (for example: in order 2023-01, 2023-08, 2023-09 for b).

What should I change in Measure 2?

Thank you!

Hi @Anonymous 

You can try the following measure

Measure 2 = IF(ISINSCOPE('Table'[Column1]),RANKX(FILTER(ALLSELECTED('Table'),[Column3] in VALUES('Table'[Column3])),CALCULATE(SUM([Column1])),,ASC),IF(ISINSCOPE('Table'[Column3]),RANKX(ALLSELECTED('Table'),CALCULATE(MAX('Table'[Column3])),,DESC,Dense)))

vxinruzhumsft_0-1694418251638.png

 

Output

vxinruzhumsft_1-1694418259560.png

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.