Forum Discussion
What does "value" really mean in RANKX functions?
I have a table with a list of countries and GDP per capita:
To try to understand the RANKX function, I added a calculated column with the following fuction:
Coluna = RANKX('Indicadores económicos';'Indicadores económicos'[PIB per capita];;ASC;Dense)
I've read the DAX reference manual for this function and searched all over but can't figure out what the "value" argument is supposed to do...
Can someone please explain what this is?
Thank you so much!
3 Replies
- v-haibl-msftMicrosoft Employee
- webportalImpactful Individual
Bizarre... but thanks, I think I understood... :smileytongue:
- BhaveshPatelSuper User
The <value> argument is ranked over the values returned by the <expression for every row of the table. if value argument is ignored, expression is instead used to compute the value for ranking in the evaluation context that is calling the RANKX function.
The expression argument is using the row context while value argument may or may not use row context and is solely depends on caller of the RANKX function.
As you probably would know, CALCULATE transforms the current row context into the filter context and can be used in RANKX function.
By default, the value argument corresponds to expression argument and this is a correct choice whenever you are ranking over a DAX measure or an aggrgation expression. However, if you want to perform a ranking over a table by the value of the one of the columns of the table itself, then you need to specify the different expression in a value argument.
The value argument defines the expression to evaluate for the each row of the table mentioned in the first argument. So that it is evaluted inthe row context and can access the value of any column of the table.
and you need to use VALUES function to pass the third argument.
Hope this has clarified your understanding.
-- Adopted from the The Definitive Guide to DAX by Marco Russo and Alberto Ferrari.