Forum Discussion

nwesterhuijs's avatar
nwesterhuijs
Regular Visitor
2 years ago
Solved

Calculated Column to Measure - RANKX & EARLIER

I have a calculated column, that I would like to implement as measure:        Rank = RANKX ( FILTER ( Boston_All, EARLIER (Boston_All[Cat]) = Boston_All[Cat] ), Bost...
  • Fowmy's avatar
    2 years ago

    nwesterhuijs 

    You can use the following measure:

    Rank = 
    
    VAR __Source = ALLSELECTED( Boston_All[Index] , Boston_All[Cat] )
    VAR __Result = 
        RANK(
            DENSE,
            __Source,
            ORDERBY( Boston_All[Index],ASC , Boston_All[Cat], ASC ),,
            PARTITIONBY( Boston_All[Cat] )
        ) - 1
    RETURN
       IF( ISINSCOPE(Boston_All[Index] ) ,  __Result )