Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

RANKX with Filter

Hi Team, 

 

I have this table that has been working for me but I need a little modification.

 

 

Basically, I am ranking the agents based on their respective Overall Scores. This is the code for the table above.,

 

 

Ranking = RANKX(ALL('TPV Agents'[Agent Name]), [Overall Score])

 

 

What do I want?

I want to rank the agents based on their overall score and the "No of Calls" should be above 25 calls. So any agent with less than 25 calls should not be ranked. Based on the above table, the expected result will look like this...

 

 

 

 

 

 

 

 

 

 

 

 

 

  • Anonymous try this measure assuming the number of calls and the overall score is measures.

     

    Ranking = 
    VAR __table = ADDCOLUMNS ( ALL ( 'Table'[Agent] ), "@Call", [No of Calls] )
    RETURN  
    IF ( [No of Calls] >= 25, 
        RANKX ( FILTER ( __table, [@Call] >= 25 ), [Overall Score] ) 
    )

     

    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.

     

     

2 Replies

  • Anonymous are those measures or columns (No of calls and overall score)?

  • Anonymous try this measure assuming the number of calls and the overall score is measures.

     

    Ranking = 
    VAR __table = ADDCOLUMNS ( ALL ( 'Table'[Agent] ), "@Call", [No of Calls] )
    RETURN  
    IF ( [No of Calls] >= 25, 
        RANKX ( FILTER ( __table, [@Call] >= 25 ), [Overall Score] ) 
    )

     

    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.