Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
I have tried the RankX function in a measure (and not in a column) but i am not sure to understand, what happened :
I mean when i don't add the Calculate function, The rank function stay to 1
RankMeasureFail2 = RANKX(ALL(Table1),SUM(Table1[Price]))
But this measure works : RankxMeasure = RANKX(ALL(Table1),CALCULATE(SUM(Table1[Price])))
A screen about my data :
@Anonymous , In Rankx and X function, you need to add calculate to make sure calculation get evaluated properly
Refer, it has been explained here
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
@Anonymous RANKX function creates a row context, the second parameter works on the context. if you just use SUM(), this works on current filter context, ie sum of all the price, then all the row in the same position. if add a CALCULATE function, then it transform current row context into filter context, then the sum is only of the rows filtered by this transformed context, ie sum of rows which is identical with current row.
Hi, @Anonymous , it's all about some fundamental concepts in DAX, namely evaluation context and context transition. You might want to refer to the articles I linked or google them yourself.
As to RANKX ( <Table>, <Expression> [, <Value>] [, <Order>] [, <Ties>] ), <Table> is iterator, providing row context to <Expression>. One of the most remarkable features of CALCULATE()/CALCULATETABLE() functions is context transition, the row context is transited to filter context for the calculation of expression parameter, i.e. SUM(Table1[Price]) here.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
10 | |
10 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |