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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi all,
i'm struggling with a chalenge to obtain measures with correspondent values of a column where rank is n; the table is virtual, a summarized one in dax with rank added.
initial_table:
| Attr | result |
| A | 1 |
| A | 2 |
| B | 3 |
| B | 3 |
| B | 3 |
| C | 3 |
| C | 3 |
| D | 10 |
summarized virtual table is like this:
| Attr | result | _rank_desc |
| A | 3 | 4 |
| B | 9 | 2 |
| C | 6 | 3 |
| D | 10 | 1 |
and i need
measure1 = C
measure2 = 6
where rank is 3; related values for it
Thanks,
Cosmin
Solved! Go to Solution.
Hi @cosminc ,
You can create a what-if parameter to provide the dynamic rank n.
Use what-if parameters to visualize variables - Power BI | Microsoft Learn
Then create the following two measure.
Measure1 = var _table=SUMMARIZE('Table','Table'[Attr],"res",SUM('Table'[result]))
var _table2= ADDCOLUMNS(_table,"rank",RANKX(_table,[res],,DESC,Dense))
return MAXX(FILTER(_table2,[rank]=SELECTEDVALUE(Parameter[Parameter])),[Attr])Measure2 = var _table=SUMMARIZE('Table','Table'[Attr],"res",SUM('Table'[result]))
var _table2= ADDCOLUMNS(_table,"rank",RANKX(_table,[res],,DESC,Dense))
return MAXX(FILTER(_table2,[rank]=SELECTEDVALUE(Parameter[Parameter])),[res])
You can download my attachment for details.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @cosminc ,
You can create a what-if parameter to provide the dynamic rank n.
Use what-if parameters to visualize variables - Power BI | Microsoft Learn
Then create the following two measure.
Measure1 = var _table=SUMMARIZE('Table','Table'[Attr],"res",SUM('Table'[result]))
var _table2= ADDCOLUMNS(_table,"rank",RANKX(_table,[res],,DESC,Dense))
return MAXX(FILTER(_table2,[rank]=SELECTEDVALUE(Parameter[Parameter])),[Attr])Measure2 = var _table=SUMMARIZE('Table','Table'[Attr],"res",SUM('Table'[result]))
var _table2= ADDCOLUMNS(_table,"rank",RANKX(_table,[res],,DESC,Dense))
return MAXX(FILTER(_table2,[rank]=SELECTEDVALUE(Parameter[Parameter])),[res])
You can download my attachment for details.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
perfect!! this i didn't know
MAXX(FILTER(_table2,[rank]=SELECTEDVALUE(Parameter[Parameter])),[res])
Thanks a lot!
Cosmin
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 50 | |
| 49 | |
| 35 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 91 | |
| 75 | |
| 41 | |
| 26 | |
| 25 |