Forum Discussion

cdcphist's avatar
cdcphist
Frequent Visitor
5 years ago
Solved

Ranking in subcategories

Hi,   I have the following data:   ID Company Value Ranking in company Total Ranking 1 A 15 1 7 2 A 5 3 14 3 A 12 2 9 4 B 18 1 2 5 B 4 4 16 6 B 3 6...
  • selimovd's avatar
    5 years ago

    Hey cdcphist ,

     

    you can filter the table that has to be considered to the current row context company.

    Try the following calculated column:

    Rank company = 
    VAR vRowCompany = myTable[Company]
    VAR vFilterTable = FILTER( myTable, myTable[Company] = vRowCompany )
    RETURN
        RANKX( vFilterTable, myTable[Value] )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
  • Jihwan_Kim's avatar
    5 years ago

    Hi, cdcphist 

    I am not sure if I understood your question correctly but please check the below picture and the sample pbix file's link down below.

     

     

    Rank in Each Company CC =
    VAR currentcompany = 'Table'[Company]
    RETURN
    RANKX ( FILTER ( 'Table', 'Table'[Company] = currentcompany ), 'Table'[Value] )

     

    https://www.dropbox.com/s/yseko7od474icwa/cdcphist.pbix?dl=0 

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM