Forum Discussion

dmoney7612's avatar
dmoney7612
Helper II
4 years ago
Solved

Need help with ranking expression

I am trying to create a ranking expression based on average daily sales growth for my account managers. As you can see in the below image, it is not working correctly. The expression I'm using is the following: 

Pref Supplier Rank = IF (
HASONEVALUE ( 'EC Hierarchy'[Account Manager] ),
RANKX (
ALL ('EC Hierarchy'[Account Manager]),
CALCULATE( [ADS % Growth] )))
 
If anyone has some insight with this it would be much appreciated. Thanks in advance
 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi dmoney7612 ,

     

    You can refer to this article about ranking in power bi.

    Since there is no data model, it is suggested to try

    Pref Supplier Rank = 
    RANKX (ALLSELECTED('EC Hierarchy'),[ADS % Growth],,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.

10 Replies

  • dmoney7612 check this post and fix the DAX measure accordingly. it is well explained and should solve your issue.

     

    Follow us on LinkedIn

     

    Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts 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.

    • dmoney7612's avatar
      dmoney7612
      Helper II

      parry2k Appreciate the resource but I am still having issues because the ADS % Growth that I want ranked is already a calculated measure, and therefore does not populate when using the CALCULATE(SUM( expression. I can't seem to find a workaround.

  • dmoney7612 let's do one step at a time. Did rank work out? I think that was your original question. If yes, it worked out, what else do you want to achieve?

  • dmoney7612 that reply is not very helpful 😃

     

    Maybe easier share pbix file with sample data and explain what you are looking for and let's go from there. 

    • dmoney7612's avatar
      dmoney7612
      Helper II

      It says pbix is not supported when I try to drag the file in

    • dmoney7612's avatar
      dmoney7612
      Helper II

      I'm not comfortable doing that. I thought I already explained it pretty well but I will say it again. The measure that I am trying to rank (ADS % Growth) is already a calculated measure and is not supported by the CALCULATE(SUM( DAX expression. I simply want the below percentages to be ranked appropriately (so the 333.86% would be ranked 1, the 230.68% ranked 2, etc. This is the DAX expression I currently have:

       

      Pref Supplier Rank = IF (
      HASONEVALUE ( 'EC Hierarchy'[Account Manager]),
      RANKX (
      ALL ( 'EC Hierarchy'[Account Manager] ),
      CALCULATE( [ADS % Growth])))

       

      Again, CALCULATE(SUM( does not seem to appropriate in this scenario

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi dmoney7612 ,

         

        You can refer to this article about ranking in power bi.

        Since there is no data model, it is suggested to try

        Pref Supplier Rank = 
        RANKX (ALLSELECTED('EC Hierarchy'),[ADS % Growth],,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.