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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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?



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

Top Solution Authors