Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
webportal
Impactful Individual
Impactful Individual

What does "value" really mean in RANKX functions?

I have a table with a list of countries and GDP per capita:

 

Capturar.PNG

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!

 

1 ACCEPTED SOLUTION
v-haibl-msft
Employee
Employee

@webportal

 

You can take a look at the last part of this blog. It explains how rankx works when we specific the third value argument.

 

Best Regards,

Herbert

View solution in original post

3 REPLIES 3
v-haibl-msft
Employee
Employee

@webportal

 

You can take a look at the last part of this blog. It explains how rankx works when we specific the third value argument.

 

Best Regards,

Herbert

Bizarre... but thanks, I think I understood... Smiley Tongue

BhaveshPatel
Community Champion
Community Champion

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.

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.