Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi All,
I would like to add a rank column for virtual table created by Dax function, my code as below
DEFINE
	MEASURE Sales[sale_amount] = sumx(Sales, Sales[Quantity] * Sales[Net Price])
	
	var temp = SUMMARIZECOLUMNS (
	    Customer[Country],
	    "Sales Amount1",Sales[sale_amount]
	
		)
EVALUATE
	ADDCOLUMNS(temp, "rankx",rankx(
	    		Customer[Country],
	    		Sales[sale_amount]
			)
		)I got the error say "Table variable name 'temp' can not be used in the current context because a base table is expected" , this mean Rankx function can not work with virtual table created by Dax code ??
Dataset used in the lab from this link Introducing RANKX in DAX
Hi,
Please try something like below.
DEFINE
    MEASURE Sales[sale_amount] =
        SUMX ( Sales, Sales[Qualtity] * Sales[Net Price] )
    VAR temp =
        SUMMARIZECOLUMNS ( Customer[Country], "Sales Amount1", Sales[sale_amount] )
EVALUATE
ADDCOLUMNS (
    temp,
    "rankx", RANKX ( VALUES ( Customer[Country] ), Sales[sale_amount] )
)
					
				
			
			
				hi @Jihwan_Kim ,
The code provided work as well, however could you please help clarify why we can not use the code below ?
"rankx", RANKX ( VALUES ( temp[Country] ), temp[Sales Amount1] )
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
            | User | Count | 
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | 
| User | Count | 
|---|---|
| 24 | |
| 11 | |
| 11 | |
| 9 | |
| 8 |