Forum Discussion

adelmonte's avatar
adelmonte
Icon for Resolver I rankResolver I
4 years ago
Solved

rankx multiple columns allselected

Hi all,

Can someone please give me a tip how to rank correctly my table.

 

M_TotalScore = SUM('ranking'[TOTAL SCORE])
M_Rank = RANKX(ALLSELECTED('ranking'), [M_TotalScore],,DESC,Dense)

 

Thanks,

Alex

  • Hi adelmonte ,

    According to your description, if you want to use RANKX function in a measure, add a CALCULATE function before it, modify the formula to:

    Rank =
    RANKX (
        ALLSELECTED ( 'ranking' ),
        CALCULATE ( SUM ( 'ranking'[TOTAL SCORE] ) ),
        ,
        DESC,
        DENSE
    )
    

    In my sample get the correct result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

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

     

3 Replies

  • adelmonte on what column do you want to RANK?

     

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

  • Hi adelmonte ,

    According to your description, if you want to use RANKX function in a measure, add a CALCULATE function before it, modify the formula to:

    Rank =
    RANKX (
        ALLSELECTED ( 'ranking' ),
        CALCULATE ( SUM ( 'ranking'[TOTAL SCORE] ) ),
        ,
        DESC,
        DENSE
    )
    

    In my sample get the correct result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

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