Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Rankx for different tables

Hi All,

 

I need to perform Rank function. I believe it not works when we take multiple tables into consideration.

 

Please consider the following scenario:

I have a table 1 as below:

Countries
US
UK
HK
SG
MY

 

Table 2:

CountriesValues
United States10
United States30
United Kingdom5
Singapore10

 

The expected table should be as below: 

 

CountriesValuesRank
US401
SG102
UK53

For US, we will be summing Value column from Table 2 where Countries = United States. Similarly SG = Singapore, UK = United Kingdom. I got the Values column, but couldnt find a DAX formula to calculate RANK.

  • I feel like I am missing something but the standard RANKX did not yield the expected result.  Here's my version of the measure:

     

     

     

    Looking forward to see how it should actually be done.

2 Replies

  • I feel like I am missing something but the standard RANKX did not yield the expected result.  Here's my version of the measure:

     

     

     

    Looking forward to see how it should actually be done.

  • Hi,

    In the first table aren't you missing a crucial column - name of the Country?  Once that is there, you can create a relationship from Table2 to Table1.  Drag Country from Table1 to your visual and the standard RANKX() function should work.