Forum Discussion
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:
| Countries | Values |
| United States | 10 |
| United States | 30 |
| United Kingdom | 5 |
| Singapore | 10 |
The expected table should be as below:
| Countries | Values | Rank |
| US | 40 | 1 |
| SG | 10 | 2 |
| UK | 5 | 3 |
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
- lbendlin
Super User
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.
- Ashish_Mathur
Super User
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.