Forum Discussion

therenjithr's avatar
therenjithr
Frequent Visitor
5 years ago
Solved

Custom Sort Attribute row in unpivot matrix

I created a matrix and below is the format

 

Attributes8/1/20218/2/20218/3/20218/4/20218/5/2021
A2342342323689
B45345234234689
C3345234234689

 

but I want to custom sort the rows like below. Please help

 

Attributes8/1/20218/2/20218/3/20218/4/20218/5/2021
C3345234234689
A2342342323689
B45345234234689
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  therenjithr ,

    Here are the steps you can follow:

    You can sort according to the customization of Power query.

    1. Enter Power query through Transform data, select Add Column – Column From Examples From All Columns.

    2. Enter Index123 corresponding to ABC in the column next to it.

    3. Select column [Attribute], Column tools – Sort by column – column [Custom].

    4. Select Sort ascending in the column [Custom].

    5. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

4 Replies

    • therenjithr's avatar
      therenjithr
      Frequent Visitor

      This is  the actual format of data. I created another table with index column and column name and then did the mapping in model. But in the visualization sorting doesnt work unless I add "Sort Column" as either in rows or columns. 

       

      DatesColumnNameValuesSortColumn
      8/1/2021A2340
      8/1/2021B1351
      8/2/2021A41230
      8/3/2021B351
      8/4/2021B2331
      8/5/2021C4562
      8/5/2021C2432
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  therenjithr ,

    Here are the steps you can follow:

    You can sort according to the customization of Power query.

    1. Enter Power query through Transform data, select Add Column – Column From Examples From All Columns.

    2. Enter Index123 corresponding to ABC in the column next to it.

    3. Select column [Attribute], Column tools – Sort by column – column [Custom].

    4. Select Sort ascending in the column [Custom].

    5. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

  • therenjithr's avatar
    therenjithr
    Frequent Visitor

    I do not had to do step 2, but I used merge query to add mapped column from related table in actual table then followed ur steps on sorting, did the trick. Thanks for your effort.