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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
grkanth81
Helper I
Helper I

Sort column Headers in a Matrix

Hi Guys,

Can we control the sorting for the column headers in a matrix ?The row and the column sorting should be done based on other columns (here i ahve created 2 new columns in the data model Employee_Sort and Days_Sort) which are not there in the matrix table.

Here is what i have created in Power BI matrix table :

Capture111.PNG

 

As you can see from the above the rows and columns are automatically got sorted by alphabetical order.

But i would like to display as below. Is this possible ?

 

Capture222.PNG

Thanks,

Ravi

1 ACCEPTED SOLUTION

Hi,

 

You may refer to my solution in this PBI file.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

12 REPLIES 12
Vmpbi
Frequent Visitor

Thanks for sharing… check out the links below. It provides a comprehensive guide on how to sort measures as columns

in a matrix visual.

https://insurancedatainsights.blog/2024/04/27/dynamic-data-display-matrix/

Unlock Dynamic Data Display In Your Power BI Matrix

 

Ashish_Mathur
Super User
Super User

Hi,

 

This should be possible.  Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish, 

Thanks for your reply.

Please find the attached pbi file and source data

 

https://www.dropbox.com/s/n62qnufl5gnw3ru/TEST_Data.pbix?dl=0

 

https://www.dropbox.com/s/gu0imya50uh58nb/TEST_Data.xlsx?dl=0

 

 

 

Thanks,

Ravi

Hi,

 

You may refer to my solution in this PBI file.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you, Ashish, for the example file. I used it to model my own data and it worked. 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

1. Created Category/Employee table

2. Linked the above tables to the FACT table

3. Created Category/Employee column in the FACT table.

 

I have replicated the above steps same like yours but it is still not working. Not sure what has been missed out. Please kindly let me know what is that i have missed out here.

Thank you Ashish.

That worked perfectly.

 

One more small question. Is it possibe to rename the column Total as Employees Total ?

 

Thannks again.

 

Ravi....

You are welcome.  No, i don't think that is possible.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks Ashish.

v-shex-msft
Community Support
Community Support

Hi @grkanth81,

 

AFAIK, current power bi not support custom order of columns, it only support default sort order. I'd like to suggest you submit an idea for this requirement.

 

Maybe you can try to add calculate column to modify column with custom prefix string to achieve custom sort order.

Custom Category =
VAR _prefix =
    SWITCH (
        [Category],
        "Not_Applicable", "0_",
        "0-30 Days", "1_",
        "31-60 Days", "2_",
        "61-90 Days", "3_",
        "91-120 Days", "4_",
        "120+ Days", "5_",
        "z_"
    )
RETURN
    _prefix & [Category]

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thanks Xiaoxin Sheng for you reply.

 

There seems to be other related ideas already requested and i have now voted it 

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/15038169-multiple-column-sort?pag...

 

Thanks for your SWITCH suggestion, But when i did in that way the row headers are displaying as below and i don't want to see that starting text 0_, 1_, 2_ etc....and I guess we can't get rid of them while displaying. I am not sure.

 

Capture333.PNG

 

Thanks,

Ravi

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.