Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Excel IF RANK Formula in DAX

Hi, 

 

I am struggling to acheive a ranking in PBI. In Excel the formula is:

 

=IF(A45="","",IF(A45<>"",RANK(D45,$D$45:$D$9999),""))

 

Column A = Customer Name

Column D = Margain figures

 

Is there a DAX version of this at all please?

 

Thanks in advance

 

 

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous ,

     

    Do you want to use DAX to calculate the ranking of the corresponding margin among all customers' margins when the customer name is not empty? If I understand correctly, you can try the following formula.

     

    Create a calculated column.

    rank = IF('Table'[Customer Name]="",BLANK(),RANKX(FILTER(ALL('Table'),'Table'[Customer Name]<>""),'Table'[Margain figures]))

    The output of my test.

     

     

     

    ———————————————————————————————————————————————————

    If my answer helps you solve the problem, please accept my answer as a solution and let it be seen by more people in need.

     

    Best regards,

    Mengmeng Li

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Do you want to use DAX to calculate the ranking of the corresponding margin among all customers' margins when the customer name is not empty? If I understand correctly, you can try the following formula.

     

    Create a calculated column.

    rank = IF('Table'[Customer Name]="",BLANK(),RANKX(FILTER(ALL('Table'),'Table'[Customer Name]<>""),'Table'[Margain figures]))

    The output of my test.

     

     

     

    ———————————————————————————————————————————————————

    If my answer helps you solve the problem, please accept my answer as a solution and let it be seen by more people in need.

     

    Best regards,

    Mengmeng Li