Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Rankx to consider a subset filtered using a variable

Hi all,
This is my measure,
OverallScoreVarianceRankNew =
var cmp = if([OverallScoreVariance]=[Overall %],0,if([Overall %]=blank(),0,1))/
var filteredusers = CALCULATE(max('KPI'[NT_UserName]),filter('KPI',cmp=1))

//  I want to rank only those people who have Overall % & ([OverallScoreVariance] <>[Overall %], thats why a filter condition is given here, now I want to rank only these usernames not sure how to achieve this
 
var OverallScore = IF( SELECTEDVALUE('KPI'[NT_UserName]) <> nt, BLANK(), CALCULATE(RANKX(ALL('KPI'[NT_UserName]),[OverallScoreVariance],,DESC,Dense),ALLEXCEPT('KPI','KPI'[NT_UserName],'KPI'[WeekNew]))) // this is my current formula which ranks everyone, not sure how to include a condition here which takes only the filteredusers for ranking

return
 
OverallScore
 
 
any help to modify this would be nice, this is a measure, 'KPI'[NT_UserName],'KPI'[WeekNew] are the data columns
Thanks
3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

Can you provide some sample data and expected result in table format so that we can use them to test and check the measures?

 

You may refer to the measure structure in this thread: Rankx with filter - Microsoft Power BI Community. Filter the table provided as the first variable in RANKX() function. 

 

Best Regards,
Community Support Team _ Jing

Anonymous
Not applicable

What if you add an ALLSELECTED ( KPI ) argument to your CALCULATE?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.