Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Rank within a sub category

Hello,   I am trying to rank a seies of values. Here is a sample:   VendorID     Total     Classification 1                   5           N 2                   2           N 3                 ...
  • v-alq-msft's avatar
    5 years ago

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

    Table:

     

    You may create a calculated column or a measure as below.

    Calculated column:

     

    Rank Column = 
    RANKX(
        FILTER(
           ALL('Table'),
           [Classification]=EARLIER('Table'[Classification])
        ),
        [Total]
    )

     

    Measure:

     

    Rank Measure = 
    RANKX(
        FILTER(
            ALL('Table'),
            [Classification]=MAX('Table'[Classification])
        ),
        CALCULATE(SUM('Table'[Total]))
    )

     

     

    Result:

     

    Best Regards

    Allan

     

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