Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Create a ranking column on a Table Visual with DAX

I have a table visual and would like to have an index column that will assist with making the ranking easier. So the table is as follows Name   Points   GD John   17   6 Erick   ...
  • Mikelytics's avatar
    Mikelytics
    3 years ago

    HI Anonymous 

     

    Understood! Please try the following Measures. It includes a small workaround (second measure). From my understanding the challenge we have is to prioritize points and if points are equal then we have to look on the GD, right?

     

    Your Base table

     

    first I built a measure only using points for ranking

     

    RANK Table (only Points) = 
    
    
    RANKX(
        ALL(RankingTable[Name]),
        CALCULATE(SUM(RankingTable[Points]))
    )

     

     

    NOw for adding the GD as a second priority I used a small trick by adding the SUM of GD and dividing it by 100 so that you get for sorting [POINTS],([GD]/100). As long the sum of GD can not be higher 100 it works. when GD can become higher, then you can also multiple 1000 or more.

     

     

     

     

    RANK Table (Points and GD) = 
    
    RANKX(
        ALL(RankingTable[Name]),
        CALCULATE(SUM(RankingTable[Points]) + SUM(RankingTable[GD])/100)
    )

     

    There might be a better solution but I am a little bit on the run but wanted to give you a solution. 🙂

     

    Best regards

    Michael

    -----------------------------------------------------

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

    @ me in replies or I'll lose your thread.

    -----------------------------------------------------

    LinkedIn