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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors