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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jcastr02
Post Prodigy
Post Prodigy

Sort Matrix by AttributeSort column

I have a matrix visual and I'd like to be able to sort the columns in a specific order.  I created a conditional column within the data table to create a numerical number based on the "Attribute" Column.  (ie. If it's X, then give me X number, etc.).  I went tables and then sorted the attritbute column by the AttributeSort column.  However, my visual still stays in alphabetical order.  Any ideas?

Screenshot 2025-06-10 144439.pngScreenshot 2025-06-10 144609.png

1 ACCEPTED SOLUTION
v-achippa
Community Support
Community Support

Hi @jcastr02,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Power bi does not apply custom sort order to the fields used in the columns section of a matrix visual. Even if the column is sorted correctly in the data model, the matrix will still show the column headers in alphabetical order by default. So please follow below steps:

 

  • Create a new supporting table with the required Attribute values and a custom sort order column.

    AttributeSortTable =

    DATATABLE(

        "Attribute", STRING,

        "SortOrder", INTEGER,

        {

            {"Area Name", 1},

            {"Specialty", 2},

            {"Central Pharmacy", 3},

            {"Midwest Specialty", 4},

            {"New England Spec", 5}

        }

    )

     

  • In this new table, go to the Attribute column and use Sort by Column and choose SortOrder.
  • Use this new Attribute column in the Columns section of the matrix visual instead of the original one.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

View solution in original post

5 REPLIES 5
v-achippa
Community Support
Community Support

Hi @jcastr02,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Power bi does not apply custom sort order to the fields used in the columns section of a matrix visual. Even if the column is sorted correctly in the data model, the matrix will still show the column headers in alphabetical order by default. So please follow below steps:

 

  • Create a new supporting table with the required Attribute values and a custom sort order column.

    AttributeSortTable =

    DATATABLE(

        "Attribute", STRING,

        "SortOrder", INTEGER,

        {

            {"Area Name", 1},

            {"Specialty", 2},

            {"Central Pharmacy", 3},

            {"Midwest Specialty", 4},

            {"New England Spec", 5}

        }

    )

     

  • In this new table, go to the Attribute column and use Sort by Column and choose SortOrder.
  • Use this new Attribute column in the Columns section of the matrix visual instead of the original one.

 

If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

 

Thanks and regards,

Anjan Kumar Chippa

jcastr02
Post Prodigy
Post Prodigy

I don't have ability to sort by attribute either.

Screenshot 2025-06-10 172401.png

jcastr02
Post Prodigy
Post Prodigy

@samratpbi apologies for confusion the AttributeSort column was created in Power Query, then I went to Tables and did the Sort by columns but it's still not ordering the information in the sort order I designated.

samratpbi
Super User
Super User

Hi, sorting the table view will not sort your data. In this case, better to create that AttributeSort column using Power Query. Then in the table view, select Attribute column use the feature "Sort by Column" and select AttributeSort column. That will sort your Attribute column in all the visuals wherever being used.

samratpbi_1-1749584612929.png

 

 

Hope this helps to resolve your problem; if it does, then please mark it as solution and dont forget to give kudos. 

Thanks - Samrat

I don't have ability to "sort by" attribute....
Screenshot 2025-06-10 172401.png

Helpful resources

Announcements
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.

June 2025 community update carousel

Fabric Community Update - June 2025

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