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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
jsm2116
Frequent Visitor

Custom Matrix Column Order

I am creating a Matrix in power BI from a 4 million record 80 column from a direct sql query. The matrix column headers are date spans are out of order. The output defaults to this order 0 to 29 , 180+ , 30 to 89 and 90 to 179 . I would like the column headers to be in this order 0 to 29 , 30 to 89 and 90 to 179 , 180+. With thew 180+ as the last column. After much searching I have not found a solution. Can this be accomplished? Thank you in advance.

1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @jsm2116 

 

You might consider inserting an index column and sort by it.

 

Here're other threads could be your reference:

https://community.powerbi.com/t5/Desktop/Matrix-Column-Head-Order/m-p/71572 

https://community.powerbi.com/t5/Desktop/Ordering-matrix-by-column-head-column-head-is-a-custom-colu... 

 

Also, you use a SWITCH expression (instead of nested IFs) in your calculated column.  Something like

 

SortOrder = SWITCH(Table[Column], "0-29",1,"30 to 89",2,"90-179",3,"180+",4)

 

where Table[Column] is replaced by the column used in your matrix columns.

 

 

If not help, kindly share your dummy pbix.

 

 

 

 

 

 

 

 

 

 

 

Community Support Team _ Dina Ye
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
v-diye-msft
Community Support
Community Support

Hi @jsm2116 

 

You might consider inserting an index column and sort by it.

 

Here're other threads could be your reference:

https://community.powerbi.com/t5/Desktop/Matrix-Column-Head-Order/m-p/71572 

https://community.powerbi.com/t5/Desktop/Ordering-matrix-by-column-head-column-head-is-a-custom-colu... 

 

Also, you use a SWITCH expression (instead of nested IFs) in your calculated column.  Something like

 

SortOrder = SWITCH(Table[Column], "0-29",1,"30 to 89",2,"90-179",3,"180+",4)

 

where Table[Column] is replaced by the column used in your matrix columns.

 

 

If not help, kindly share your dummy pbix.

 

 

 

 

 

 

 

 

 

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

@jsm2116 , You need to create a sort and then for bucket column mark it as sort column

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.