Forum Discussion

scabral's avatar
scabral
Helper IV
4 years ago
Solved

Create dynamic Ranking measure

Hi,

 

have the following table:

 

ClassificationDivision OperationsValueYear
HealthcareEasternBoston1,000,0002021
HelathcareWesternLos Angeles500,0002021
HealthcareWesternSan Francisco250,0002021
ManufacturingSouthernTexas100,0002020
ManufacturingSouthernFlorida5,400,0002020

 

So each field (except Value) will be a slicer.  The ranking will need to be done dynamically depending on what slicers are selected.  So if Healthcare is selected, the ranking will take into account the 3 rows for healthcare and rank by value descending.  If Healthcare and Los Angeles are selected, then the ranking will be done with just that row.  If no slicers selected, than rank entire table.

 

not sure how to use Rankx function to get this done.  So far my results don't bring back what i am expecting.

 

Scott

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi scabral ,

     

    The formula should be:

    Measure = Rankx(ALLSELECTED('Table'),CALCULATE(Sum('Table'[Value])),,desc,dense)
    Otherwise it will always return 1.
     
    Best Regards,
    Jay

2 Replies