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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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!

Anonymous
Not applicable

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors