Forum Discussion

maurcoll's avatar
maurcoll
Helper IV
2 years ago
Solved

Help with adding sort to a measure

Hi

I have a simple measure

Calculate(Sum ('Table' [Sales]))

what i want to be able to do is add in something to sort by asc or desc.

I have tried adding

Calculate(
Sum 'Table' [Sales]), , asc, dense) but this is not working.
Any ideas please

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi maurcoll 

     

    Based on your needs, I have created the following form.

     

     

    You can use the following formula to get the ranking of the sales column

    Sales Rank = 
    RANKX(
        ALL('Table'), 
        CALCULATE(SUM('Table'[Sales])),
        , 
        DESC,
        Dense
    )

     

    This is the result you want

     

     

    Best Regards,

    Jayleny

     

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

     

     

2 Replies

  • PijushRoy's avatar
    PijushRoy
    Community Champion

    Hi maurcoll 

    If you are using the above measure in any visual, in visual you have the sort option
    Or you can sort by category

    Can you please share the screenshot of the requirement?

    If your requirement is solved, please make sure to MARK AS SOLUTION and help other users find the solution quickly. Please hit the LIKE button if this comment helps you.

    Thanks
    Pijush


  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi maurcoll 

     

    Based on your needs, I have created the following form.

     

     

    You can use the following formula to get the ranking of the sales column

    Sales Rank = 
    RANKX(
        ALL('Table'), 
        CALCULATE(SUM('Table'[Sales])),
        , 
        DESC,
        Dense
    )

     

    This is the result you want

     

     

    Best Regards,

    Jayleny

     

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