Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Change columns order in Matrix

Hello,

 

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

 

 

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!

 

 

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

6 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

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

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        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.