Forum Discussion

byr10112's avatar
byr10112
Microsoft Employee
4 years ago
Solved

Ranking Based on Measure

I'm trying to create a RANKX measure to rank the accounts based on a measure. The measure (formula below) calculates the percent change of scores from previous month. I would like to create a dynamic measure that will show, depending on the chosen month or the cumulative, the accounts that saw the highest increase. Below is the formula of my measure:

Score Delta = 
VAR _A = ('Advisor Score Monthly'[Average Monthly Score]/'Advisor Score Monthly'[Score Last Month])-1
RETURN
IFERROR(_A,0)

where Average Monthly Score and Score Last Month are also measures, formulas below:

Average Monthly Score = AVERAGE('Advisor Score Monthly'[Wkly Score])


Score Last Month = CALCULATE(AVERAGE('Advisor Score Monthly'[Wkly Score]), PREVIOUSMONTH('Advisor Score Monthly'[Fiscal Month Start Date]))

 

I tried creating different measures to rank, ranging from a simple RANX function found on most of these types of posts, to creating a temporary table (formula below), but nothing worked

Rank = 
var summary = SUMMARIZE(ALLSELECTED('Advisor Score Monthly'),'Advisor Score Monthly'[ID],'Advisor Score Monthly'[Fiscal Month Start Date],"Delta",'Advisor Score Monthly'[Score Delta])
var tmp= ADDCOLUMNS(summary, "RNK", RANKX(summary, [Delta],,DESC,Dense))
return  
MAXX(FILTER(tmp, AND([ID]= SELECTEDVALUE('Advisor Score Monthly'[ID]), [Fiscal Month Start Date] = 'Advisor Score Monthly'[Fiscal Month Start Date])),[RNK])

 

Is there a way for me to create such a measure?