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
Sasha
Helper III
Helper III

Sorting columns of a matrix by measure

I have the following matrix where some of the columns have the same values as some of the rows (x,y,z,a,b,c). Inside there are values of a measure

 abcdxyz
a1 3    
b 1  2  
c  1    
x   31  
y3    1 
z      1

 

What I would like is to sort the columns so it will first include the same names we have in the row and I'll get a diagonal of 1's. Something like this:

 abcxyzd
a1 3    
b 1 2   
c  1    
x   1  3
y3   1  
z     1 

 

 

Any thoughts?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

It will help. You have to maintain a column with the required SortOrder and then use the SortByColumn to sort those columns using the SortOrder that you have maintained.

 

This will result in sorted Rows and Column headers in the same order as required by you and the "diagonal ones" etc... will be formed automatically. 

 

The problem is I am not able to understand the following from your post.

 

1) Are you using the same field of any table for both Rows and Columns of a matrix visual?

2) What is the formula of the measure you have used in the visual?

3) What is your source table structure?

 

Without giving this, I think it is difficult to understand the source of the problem.  More info will help. 

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Did you try SortByColumn option?

I did, but it won't help me in this case I think

Anonymous
Not applicable

It will help. You have to maintain a column with the required SortOrder and then use the SortByColumn to sort those columns using the SortOrder that you have maintained.

 

This will result in sorted Rows and Column headers in the same order as required by you and the "diagonal ones" etc... will be formed automatically. 

 

The problem is I am not able to understand the following from your post.

 

1) Are you using the same field of any table for both Rows and Columns of a matrix visual?

2) What is the formula of the measure you have used in the visual?

3) What is your source table structure?

 

Without giving this, I think it is difficult to understand the source of the problem.  More info will help. 

 

You're right!

Thanks!

However, I succeeded only once I made a group by on a measure in other table and added a column adding space before a barber that was on the diagonal according to the group by. It wasn't straightforward in this case so if any better idea comes up - it will be great!

Thanks for insisting 🙂

 

Hi

thanks!

You can find the example here 

https://community.powerbi.com/t5/Desktop/Comparing-field-to-itself/m-p/709143#M342407

Eventually - I'd like the barbers to be in diagonal and then the rest of them will be ordered after them

 

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.