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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
diana66
Helper I
Helper I

Change columns order in Matrix

Hello,

 

I have the following matrix and I want a specific column order:

 

p7.PNG

 

For the Colum "Market" where I have the Stores, I want them in a specific order. Could you, please, tell me how can I do that?

 

Thank you!

 

 

1 ACCEPTED SOLUTION

It is going to depend on your data. But, if you have a table in which you have your values for your store identifiers, Store 1, Store 2, Store 3, etc., in Power Query createa a column that looks at those values and produces your sort order, let's say you want:

 

Store 2

Store 4

Store 3

Store 1

 

You would create a column, we will call this column "Sort", where if your Store column is Store 2, this column would be 1 and if the Store column is Store 4, 2 and so on.

 

Then, once you import this data, you would select your Store column. You would go to Column Tools and then Sort by column and choose your new Sort column.

 

Not sure I can explain the process any better than that.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

You will need to create a Sort By column that has the ordering that you want and then sort your column by that. In the new ribbon, the Sorty By is in the contextual Column Tools area and is called "Sort by column".


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi,

 

Thank you for your reply. I'm afraid I didn't understand very well how I should do it 😄

It is going to depend on your data. But, if you have a table in which you have your values for your store identifiers, Store 1, Store 2, Store 3, etc., in Power Query createa a column that looks at those values and produces your sort order, let's say you want:

 

Store 2

Store 4

Store 3

Store 1

 

You would create a column, we will call this column "Sort", where if your Store column is Store 2, this column would be 1 and if the Store column is Store 4, 2 and so on.

 

Then, once you import this data, you would select your Store column. You would go to Column Tools and then Sort by column and choose your new Sort column.

 

Not sure I can explain the process any better than that.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler ,

 

Thank you so much for the reply! It worked.

Just one more question: I had the column which I sorted by the new Sort column, in a dax formula with ALLEXCEPT(that column), and now the formula is not working. Should I replace with the new Sort column in the formula instead of the old column? 😄

I don't know, that sounds very odd. What does the formula look like that is not working?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Here I had instead of 'Sort', a column named market which is the column where I have the Store names (Store 1, Store 2, etc)

 

p8.PNG

 

I created the Sort Column with values for each store depending on my preferences, and in the Matrix table I sorted the Market column by the Sort column. 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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