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
Breitmaulpaul
New Member

How can I sort the order of the columns in a matrix table dynamically?

Hello guys,
The rows in my matrix table are sorted in descending order according to the ‘Rating’ column. The columns should also be sorted in this order from left to right. (i.e. the x's go from top left to bottom right)
Please find attached a screenshot of my curret matrix table and my Excel file.

Y axis = column A, x axis = column C
Thank you very much.

 

Breitmaulpaul_1-1739810924016.png
Breitmaulpaul_2-1739810935437.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from lbendlin , please allow me to provide another insight:

Hi, @Breitmaulpaul 
Thanks for reaching out to the Microsoft fabric community forum.

Regarding the issue you raised, my solution is as follows:

1First, you can create the following calculation column:

index = 
VAR cp = 'Table'[Player]
RETURN
    RANKX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Player] = cp ),
        [vsPlayerRating],
        ,
        DESC
    )

2.Next, sort the vsplayer columns according to the index columns:

vlinyulumsft_0-1739956198715.png

3.Here's my final result, which I hope meets your requirements.

 

vlinyulumsft_1-1739956198716.png

Here is the relevant documentation:

Sort one column by another column in Power BI - Power BI | Microsoft Learn

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

2 REPLIES 2
Anonymous
Not applicable

Thanks for the reply from lbendlin , please allow me to provide another insight:

Hi, @Breitmaulpaul 
Thanks for reaching out to the Microsoft fabric community forum.

Regarding the issue you raised, my solution is as follows:

1First, you can create the following calculation column:

index = 
VAR cp = 'Table'[Player]
RETURN
    RANKX (
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Player] = cp ),
        [vsPlayerRating],
        ,
        DESC
    )

2.Next, sort the vsplayer columns according to the index columns:

vlinyulumsft_0-1739956198715.png

3.Here's my final result, which I hope meets your requirements.

 

vlinyulumsft_1-1739956198716.png

Here is the relevant documentation:

Sort one column by another column in Power BI - Power BI | Microsoft Learn

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

 

lbendlin
Super User
Super User

Most likely you need to unpivot your data first.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

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.