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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
CJ-Flag
Frequent Visitor

How to Sort Columns in a Matrix Visual

Hello,

 

I currently have - hopefully - a small challenge. My matrix visual is defined to be sorted by rows. Now I have a field that names the columns from another table where the values are summed and counted. Now, I also want to dynamically sort the columns by the highest values of the summation.

 

CJFlag_0-1723064829509.png

 

how cani solve the use case?

 

Thanks a lot for upcoming Support!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @CJ-Flag ,

 

If you are trying to sort the columns based on the following total value.

vkaiyuemsft_0-1723454806218.png

 


1. first you can create a calculated column to get the total value.

Column =
CALCULATE (
SUM ( financials[ Sales] ),
FILTER (
ALL ( financials ),
'financials'[Month Name] = EARLIER ( 'financials'[Month Name] )
)
)

 

2. Then create a calculation table and create a one-to-many relationship with the original table.

Table =
SUMMARIZE('financials','financials'[Month Name],'financials'[Column])

vkaiyuemsft_1-1723454846936.png

 

3. Make the month name column in the calculation table sorted according to the column column.

vkaiyuemsft_2-1723454856169.png

 

4. Place the corresponding fields in the matrix.

vkaiyuemsft_3-1723454866645.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @CJ-Flag ,

 

If you are trying to sort the columns based on the following total value.

vkaiyuemsft_0-1723454806218.png

 


1. first you can create a calculated column to get the total value.

Column =
CALCULATE (
SUM ( financials[ Sales] ),
FILTER (
ALL ( financials ),
'financials'[Month Name] = EARLIER ( 'financials'[Month Name] )
)
)

 

2. Then create a calculation table and create a one-to-many relationship with the original table.

Table =
SUMMARIZE('financials','financials'[Month Name],'financials'[Column])

vkaiyuemsft_1-1723454846936.png

 

3. Make the month name column in the calculation table sorted according to the column column.

vkaiyuemsft_2-1723454856169.png

 

4. Place the corresponding fields in the matrix.

vkaiyuemsft_3-1723454866645.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

danextian
Super User
Super User

Hi @CJ-Flag,

Matrix rows can be sorted by a value field as below:

danextian_0-1723071473124.png

Please note that  sorting will be applied to the totat and there's no option to sort it by the individual column field value (jul, aug, sep, etc).





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello,

thank you very much for your reponse.

You are right but u are changing the sorting of the rows.

the rows have to fix, so a,b,c or 1,2,3

and depending on that the columns have to been sorted depending on the sum of the values.

u have a hint how to solve this?

Shravan133
Super User
Super User

To dynamically sort columns in a Power BI matrix visual by the highest values of a summation, you can follow these steps:

  1. Create a Measure for Summation:
    • First, ensure you have a measure that calculates the summation of the values you want to sort by. Let's call this measure TotalValue.

TotalValue = SUM('YourTable'[YourValueColumn])

  1. Create a Rank Measure:
    • Create a measure to rank the columns based on the summation values.

ColumnRank =

RANKX(

    ALLSELECTED('YourColumnTable'[YourColumn]),

    [TotalValue],

    ,

    DESC,

    DENSE

)

  1. Add the Rank Measure to the Matrix Visual:
    • Drag your columns field to the Columns area of the matrix visual.
    • Add the ColumnRank measure to the matrix visual as a value.
  2. Sort the Columns by the Rank Measure:
    • Click on the column header in the matrix visual to sort by ColumnRank.
    • This should dynamically sort the columns by the highest values of the summation.

 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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 Kudoed Authors