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
RichardJ
Responsive Resident
Responsive Resident

Can the Column Sequence within a Matrix visual be sorted using the column Total

Hi,

PBIX file can be found here : 

 

https://www.dropbox.com/scl/fi/syn5vuamab9qovj96lpw0/Question_About_Matrix_Sort_Order.pbix?rlkey=1pl...

 

I have two visuals in the file:

 

(1) is the total profit by Company and this is sorted in Descending Total Profit

 

I was wondering if anyone knew of a way to sort (2) so that the Columns Totals are also sorted in Descending Total Profit to match the Company Order in the column visual

Matrix Sort Order.PNG

 

If someone could explain how the matrix in (2) could be configured to show the Columns in the sequence of 

Company B then Company A then Company C from the left to right (i.e. Descending Numerical Order of Total Profit)

that would be great. 

Thanks,
Richard

1 ACCEPTED SOLUTION

Hmmm. Interesting. I haven't tested this, but here's what I'm thinking. You know how Power BI default sort is alphabetically, which presents a problem with Month Names, so in our date table we create a sort column. I'm wondering if you can create a calculated column using RANKX to rank your Companies by Total Profit. Then in your company table, sort your company name by the rank column. Then in your visual, sort by Company ASC. Give that a go and let us know if it works. 

 

**edit: on further thought, I don't think an X function will work as a calculated column. You may need to create a calculated table with SUMMARIZECOLUMNS and RANKX as your expression. Use this output as a dimension of your company table. Then use the company name value from this calculated table as your axis value in your visual.

View solution in original post

6 REPLIES 6
RichardJ
Responsive Resident
Responsive Resident

Hi @chonchar - thanks for taking the time to respond but the functionality you are describing sorts the vertical columns in vertical ascending/descending order and doesn't solve the issue described above.

"if someone could explain how the matrix in (2) could be configured to show the Columns in the sequence of 
Company B then Company A then Company C from the left to right (i.e. Descending Numerical Order of Total Profit)
that would be great. "
Thanks

Hmmm. Interesting. I haven't tested this, but here's what I'm thinking. You know how Power BI default sort is alphabetically, which presents a problem with Month Names, so in our date table we create a sort column. I'm wondering if you can create a calculated column using RANKX to rank your Companies by Total Profit. Then in your company table, sort your company name by the rank column. Then in your visual, sort by Company ASC. Give that a go and let us know if it works. 

 

**edit: on further thought, I don't think an X function will work as a calculated column. You may need to create a calculated table with SUMMARIZECOLUMNS and RANKX as your expression. Use this output as a dimension of your company table. Then use the company name value from this calculated table as your axis value in your visual.

RichardJ
Responsive Resident
Responsive Resident

Great idea @CoreyP which worked perfectly.


Although I did the rank in PowerQuery via an index I'm confident the same approach would work within a calculated column also (using SUMMARIZECOLUMNS and RANKX).

Updated pbix can be found here:  https://www.dropbox.com/scl/fi/syn5vuamab9qovj96lpw0/Question_About_Matrix_Sort_Order.pbix?rlkey=1pl...

Solved Sort Sequence.PNG

 

The Company Sort Sequence (Greatest to Smallest profit) in the matrix above now matches the order in the graph.

Nice work and thanks for taking the time to respond.
Richard

Hello,

 

I found this post: https://community.fabric.microsoft.com/t5/Desktop/Matrix-Sort-Column/m-p/2189220#M802089

 

and this one: https://community.fabric.microsoft.com/t5/Desktop/Horizontal-Sorting-of-tables/m-p/353674

 

I didn't know this, but as of two years ago you can't sore horizontally. They may have fixed this issue, but other than manually moving them, I don't think it can be done. I'll keep looking for more current documenation on this matter and reach out if I find something. 

 

Additionally, I hope I am understanding your problem correctly. 

 

Best of luck,

 

Cam

 

RichardJ
Responsive Resident
Responsive Resident

@chonchar I suspect you are correct and that there isn't a way to do this at present but wondered if anyone had found a non conventional work around/solution. 
Appreciate you sending the link to the ideas page
Thanks

Richard

chonchar
Helper V
Helper V

Hi, 

 

I'll try my best:

 

Open the filters pane with the visualization selected. On the top of that pane where the visualizaton is selected, you can click the three dots and then sort Asc/desc from there. 

 

Hope that helps,

 

Cam

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.