Forum Discussion

NLEIGH's avatar
NLEIGH
Helper I
2 years ago
Solved

Sorting by columns in a Matrix

Hi,

 

Is it possible to be able to sort by each of the columns in a Matrix (example visual below), I can sort by Total (highlighted in yellow), but want to be able to sort by the other 3 columns as well.

many thanks,

 

  • NLEIGH's avatar
    NLEIGH
    2 years ago

    Hi, I would like to be able to sort by each of the columns in the same way that you can sort by the total column. However I have now changed the visual from a Matrix to a table and that has given me something that works, so we can now consider this question solved.

     

    Many thanks

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi NLEIGH 

     

    Maybe you can try to use the ROWNUMBER() function to sort the columns:

    Here I create a set of sample for your reference:

    Then add a calculated column:

    Column =
    ROWNUMBER ( ORDERBY ( 'Table'[Column2], ASC, 'Table'[Column1], ASC ) )
    

    The result is as follow:

    Here for your reference:

    ROWNUMBER function (DAX) - DAX | Microsoft Learn

    ORDERBY function (DAX) - DAX | Microsoft Learn

     

    Best Regards

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

    • NLEIGH's avatar
      NLEIGH
      Helper I

      Hi, Many thanks for taking the time to reply, however I dont believe this solves the issue.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi NLEIGH 

         

        So what is your target outcome?

         

        Best Regards

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