Forum Discussion

Vish24's avatar
Vish24
Helper II
6 years ago
Solved

Need help with ranking

Hello, I am really struggling in ranking my data. I have data like this: Name   Sales  Year A           100    2019 A           50     2019 A           25     2018 B          100    2019 B    ...
  • JarroVGIT's avatar
    6 years ago

    Hi Vish24 ,

     

    You can use a measure like this:

    Measure = 
    VAR _tmpTable = SUMMARIZE(ALLSELECTED(Table1), Table1[Name], "SalesTotal", SUM(Table1[Sales ]))
    VAR _rankedTable = ADDCOLUMNS(_tmpTable, "Rank", RANKX(_tmpTable, [SalesTotal], , DESC, Dense))
    RETURN
    MAXX(FILTER(_rankedTable, [Name] = SELECTEDVALUE(Table1[Name])), [Rank])

    Resulting in a visual like this:

     

    Kind regards

    Djerro123

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

    If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

    Keep those thumbs up coming! 🙂