Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Dynamically rank calculated measure based on different groupings

Hi All, 

I'm having some trouble getting my rank to work properly and was hoping for some assistance. As you can see below, my Industry Per Caps Rank column is not what you would expect. I'd like the per caps rank for product A to be 1, product B to be 2, and so on. My formula is below as well. Does anyone know what I may be doing wrong here? I also want the ranking to update dynamically based on the slicer I'm using (e.g., instead of product, rank by manufacturer, etc). Any help would be greatly appreciated!!

 

Industry Per Caps Rank = rankx(allselected('Nielsen (excl. dist)'),[Per Caps],,DESC,Dense)

 

 

ProductIndustry Per CapsIndustry Per Caps Rank
A2.552
B1.865
C1.687
D1.627
E1.557
F1.547
G1.1911
H0.7716
I0.5817
J0.4819
K0.4619
L0.421
M0.2628
N0.0782

17 Replies

  • SachinNandanwar's avatar
    SachinNandanwar
    Icon for Impactful Individual rankImpactful Individual
    DynamicRank =
    RANKX (
        ALLSELECTED ( 'product_industry_per_caps' ),
        CALCULATE ( MAX ( 'product_industry_per_caps'[Product] ) ),
        ,
        ASC,
        DENSE
    )

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Sachin!

       

      Thanks so much for your quick response. Would there be a way to build the formula to be able to swap out [product] column for other columns? For example, let's say I want to see per caps figures by [region] instead of [product]. Is this possible? I appreciate your insight!

      • SachinNandanwar's avatar
        SachinNandanwar
        Icon for Impactful Individual rankImpactful Individual

        Yes..

        DynamicRank =
        RANKX (
            ALLSELECTED ( 'product_industry_per_caps' ),
            CALCULATE ( MAX ( 'product_industry_per_caps'[Region] ) ),
            ,
            ASC,
            DENSE
        )