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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
afaro
Helper III
Helper III

Can I sort matrix visual based off a specific column?

Let's say I have table like this: 

 

CountryC1C2C3
ProductSalesSalesSales
P1102050
P2301060
P350010

 

Product is the rows in the matrix, Country is in the columns and Sales is the measure in the values. 

 

I want to sort let's say sort by Sales ascending in country C2, so I would get something like this: 

CountryC1C2C3
ProductSalesSalesSales
P350010
P2301060
P1102050

 

I want to do it by specific column like this. 

1 ACCEPTED SOLUTION

I showed that in my measure, with ISINSCOPE.

 

lbendlin_0-1727734736022.png

 

 

View solution in original post

7 REPLIES 7
lbendlin
Super User
Super User

Yes, change the column total to only include C2. 

 

Measure = if(ISINSCOPE('Table'[Country]),sum('Table'[Sales]),CALCULATE(sum('Table'[Sales]),'Table'[Country]="C2"))

 

 

Sort by the column total.

 

lbendlin_0-1727479606769.png

 

 

Hide the column total.

lbendlin_1-1727479625088.png

 

 

I want to have the option to change by any country whenever I want instead of keeping static just for C2. So, if I want to do by C1 and C3, then end user should be able to do that. 
To add, I don't want to create a measure where I remove the columns from matrix and explicitly add the country in the measure for example CALCULATE([Sales], Country = "C2") and so on. This is a solution but not something I am looking for since I prefer having to keep the columns.  

Sure, have a disconnected slicer for the country selection and in the measure read the current slicer value.

The measure is no longer able to read slicer value using SELECTEDVALUE if it is disconnected. 

please elaborate?

How did you change the column total to only include C2? I do not get that point. 

What I tried to do was create a new measure just for sorting. This measure would calculate the value based on the value in the slicer and not the column value coming from the matrix. However, for this I had to disconnect the matrix from the slicer but when I did this, the new measure created for sorting no longer works since disconnection led to me not being able to read the value of the slicer using SELECTEDVALUE. 

I showed that in my measure, with ISINSCOPE.

 

lbendlin_0-1727734736022.png

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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