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
Nash2Bos
Helper I
Helper I

How to re-arrange column values in a matrix table

Hi all, 

I have a table with a column, Environment with values (Dev, TE1, prod)

When i put that column into a matrix table is comes up as Dev, Prod, TE1. How can i arrange it so TE1 is in the middle and not alphabetical. 

Thank you 

2 ACCEPTED SOLUTIONS
Sahir_Maharaj
Super User
Super User

Hello @Nash2Bos,

 

Can you please try to add a new column to your table with custom sort order values:

EnvironmentSort = 
SWITCH(
    'Table'[Environment],
    "Dev", 1,
    "TE1", 2,
    "Prod", 3,
    BLANK()
)

 

Power BI uses the Sort by Column feature to override the default alphabetical sorting of text fields.

 

By creating a numeric sort column (EnvironmentSort), you can define any custom order you want.

 

Hope this helps.

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

hnguy71
Super User
Super User

Hi @Nash2Bos 

An  easy way is if you can, you'd create a unique identifier number and then sort the column by it.  The index column can be done inside powerquery and then sorted in Power BI. For example,

hnguy71_0-1736537345273.png

Then, after you've applied your changes, click sort by column:

hnguy71_1-1736537395958.png

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

7 REPLIES 7
Syndicate_Admin
Administrator
Administrator

Hello, you must create an order column to be able to adjust it to your needs. You'd want to do this directly in Power Query with a conditional column and returning a numeric value.

JETRO2000_0-1736537504842.png

Then in table view, you select the column to sort and the column tools are enabled. Select "Sort by" by referencing the created column

JETRO2000_2-1736537620974.png

That will solve your problem

hnguy71
Super User
Super User

Hi @Nash2Bos 

An  easy way is if you can, you'd create a unique identifier number and then sort the column by it.  The index column can be done inside powerquery and then sorted in Power BI. For example,

hnguy71_0-1736537345273.png

Then, after you've applied your changes, click sort by column:

hnguy71_1-1736537395958.png

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

thank you but when i try this, Prod is still in the middle of the matrix table

Hi @Nash2Bos ,
You may need to make sure that the visual sort is set to that column as well. 

hnguy71_0-1736550649130.gif

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Sahir_Maharaj
Super User
Super User

Hello @Nash2Bos,

 

Can you please try to add a new column to your table with custom sort order values:

EnvironmentSort = 
SWITCH(
    'Table'[Environment],
    "Dev", 1,
    "TE1", 2,
    "Prod", 3,
    BLANK()
)

 

Power BI uses the Sort by Column feature to override the default alphabetical sorting of text fields.

 

By creating a numeric sort column (EnvironmentSort), you can define any custom order you want.

 

Hope this helps.

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

But when i put it in the table Prod is still in the middle

This case would not work, it would create a dependency

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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.