Forum Discussion

Filippomonti's avatar
Filippomonti
Frequent Visitor
3 years ago
Solved

Help with rank in DAX

Hi everyone, 

so, let's say I have matrix like this table 

Business UnitClient_CodeClient_NameActual
BU1111Alpha10
BU1 112Beta5
BU1113Gamma30
BU2221One60
BU2222Two50
BU2223Three70
BU3331USA90
BU3332ITA52
BU3333DEU12

 

With some filters, i get this matrix

 

Business UnitClient_CodeClient_NameActual
BU1111Alpha10
BU1 112Beta5
BU1113Gamma30

 

Now, I want to create a measure to rank Client_Code for Actual to display something like this

 

Business UnitClient_CodeClient_NameActualRank by Client_Code
BU1111Alpha102
BU1 112Beta53
BU1113Gamma301

 

I tried some solutions found on internet but nothing seems to work, can someone help me please? Thank you in advance!

 

Have a nice day

 

Filippo

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Filippomonti ,

     

    You can try the following measure:

    Measure = RANKX(FILTER(ALLSELECTED('Table'),[Business Unit]=MAX('Table'[Business Unit])),CALCULATE(SUM('Table'[Actual])),,ASC,Dense)

     

     

    Best Regards,

    Stephen Tao

     

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Filippomonti ,

     

    You can try the following measure:

    Measure = RANKX(FILTER(ALLSELECTED('Table'),[Business Unit]=MAX('Table'[Business Unit])),CALCULATE(SUM('Table'[Actual])),,ASC,Dense)

     

     

    Best Regards,

    Stephen Tao

     

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