Forum Discussion

Kopek's avatar
Kopek
Icon for Helper IV rankHelper IV
4 years ago
Solved

Ranking for separate category issue

Hi!

I am trying to create a calculated column with a ranking for a values, but without any success.

The issue is that i need to create a separate ranking for each bucket (combination of unique values) within one table.

I was able to create a proper rating for entire table, but struggling with splittig that to a bucket.

The bucket for rating should be: ID, Qtr+Yr and Category.
So for each combination of unique ID, Qtr+Yr and Category value should be ranked separately, like below:

IDQtr+YrCategoryValueRank 
123Q1 2020Cat 110003
123Q1 2020Cat 115002
123Q1 2020Cat 120001

 

IDQtr+YrCategoryValueRank
123Q1 2020Cat 225001

 

IDQtr+YrCategoryValueRank
123Q4 2019Cat 110003
123Q4 2019Cat 114002
123Q4 2019Cat 115001

 

IDQtr+YrCategoryValueRank expected
123Q4 2019Cat 223452
123Q4 2019Cat 234561

 

Below you have a high level example of my data :

 

IDQtr+YrCategoryValueRank expectedRank achieved 
123Q4 2019Cat 3777714
123Q4 2019Cat 2345617
123Q1 2020Cat 2250018
123Q4 2019Cat 2234529
123Q1 2020Cat 12000110
123Q1 2020Cat 11500211
123Q4 2019Cat 11500112
123Q4 2019Cat 11400213
123Q1 2020Cat 11000316
123Q4 2019Cat 11000317
345Q1 2020Cat 19999911
345Q4 2019Cat 11111112
345Q1 2020Cat 1888823
345Q1 2020Cat 1777735
345Q1 2020Cat 2555516
345Q4 2019Cat 11113214
345Q4 2019Cat 11112315
345Q4 2019Cat 245118
345Q4 2019Cat 222219
345Q4 2019Cat 36120

 

Any suggestions are appreciated!

 

Thanks!

 

1 Reply

  • CNENFRNL's avatar
    CNENFRNL
    Icon for Community Champion rankCommunity Champion

    For fun only,

    DAX measure solution,

     

    DAX calculated column solution,

     

    PQ solution,

     

    Excel worksheet formula is powerful enough,

     

    SQL solution,