Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
How to apply a filter condition to rankx DAX?
1. I am calculating a subset of people for whom the ranks are not supposed to be generated, the subset is the variable nt and below is my dax which considers all the username
OverallScoreVarianceRankNew =
Hi @Anonymous ,
Try:
var OverallScore = CALCULATE(CALCULATE(rankx(all('KPI'[UserName]),[OverallScoreVariance],,DESC,Dense),filter('KPI',[OverallScoreVariance]<>blank()&&[UserName]<>nt)),ALLEXCEPT('KPI','KPI'[UserName],'KPI'[WeekNew]))
If it doesnt help,could you pls provide some sample data with expected output for test?
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!
@Anonymous , Try one of the two options
rankx(allselected('KPI'[UserName]),calculate([OverallScoreVariance],filter('KPI',[OverallScoreVariance]<>blank(),ALLEXCEPT('KPI','KPI'[NT_UserName],'KPI'[WeekNew]))),,DESC,Dense)
rankx(filter(allselected('KPI'[UserName]),filter('KPI',[OverallScoreVariance]<>blank(),ALLEXCEPT('KPI','KPI'[NT_UserName],'KPI'[WeekNew]))),calculate([OverallScoreVariance]),,DESC,Dense)
thanks for your response but I am not sure if it was clear hence I have edited m question as well. I want to include the variable nt inside the rankx formula, so that it exclude some of my users who dont have a score or scores and variance are equal.
rankx is not allwoing me to use the variable directly to filter, can you please suggest a workaround.
thanks @amitchandak
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 57 | |
| 44 | |
| 41 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 183 | |
| 114 | |
| 93 | |
| 61 | |
| 45 |