Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

RANKX formula help

Hi eveyone!

 

Problem is , that I cannot figure out how keep and rank only these brands, which only has value in GRP column. At the moment it considers all the brands (I know, that I have ALL function in my code).

 

Code: 

GRP rank =
VAR lastyear = MAX(Calender[Year])

VAR _rank =
    RANKX(ALL('FINAL data'[Main brands]); [Last year GRP];;DESC;Dense
    )
VAR _other =
    CALCULATE(IF ( MAX ( 'FINAL data'[Main brands] ) = "OTHERS"; 0;_rank); Calender[Year] = lastyear)
RETURN
    _other

 

How the table looks with GRP rank measure at the moment

 

Sample data and PBIX: https://we.tl/t-6fUewOOSRb

4 Replies