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
Hi All, I need help wiht a rankx within a variable table. I need to use variables instead of calculated columns as the measure I am using is dynamic and I don't want to use multiple calculated columns and switch functions.
This is the first part of the solution, I will then add percentile rank and band results.
TestTable:
| Dimension | Value |
| A | 1 |
| B | 2 |
| C | 3 |
| D | 4 |
Dax code attempt:
Rank =
Var Tbl = SUMMARIZE('TestTable',
'TestTable'[Dimension],
"Measure",SUM(TestTable[Value]))
Var AddRank = ADDCOLUMNS(Tbl,"Rank",RANKX(Tbl,[Measure]))
RETURN
SUMX(AddRank,[Rank])
The dax is currently returning a 1 for each dimension. Is there a way to use Rankx from a variable that is not a calculated column? I'm thought I might have seen a post perhaps related to this before following a really long search I cannot find a solution that works.
Solved! Go to Solution.
Hi @Anonymous
one solution I found is the following formula (see figure 1), but it is equal with the shorter formula in figure 2.
Figure 1
Figure 2
Some notes about your formula:
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
Hi @Anonymous
one solution I found is the following formula (see figure 1), but it is equal with the shorter formula in figure 2.
Figure 1
Figure 2
Some notes about your formula:
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 37 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 130 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |