Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi guys,
I'm having a little trouble around the use of the RANKX function. I've tried some videos/answers here but I feel like I'm missing something obvious, please be gentle!
I have two tables. Joined with a 1 - * relationship.
Call Occurance
Call_ID
Caller_ID
Call_DateTime
Caller
Caller_ID
Name
Country
(New column) Country Rank (see below)
I'm placing them in a table and attempting to rank the Country, by using the Total Calls #. My expectation is for the Caller table Country Rank to have a very neatly ordered 1,2,3,4, I don't need them to change with slicer selection. But instead I'm returning all 1's for Country Rank.
| Caller_ID | Name | Country | Country Rank |
| ABC1 | Joe | UK | 2 |
| ABC2 | Mitch | USA | 1 |
| ABC3 | John | USA | 1 |
| ABC4 | Kevin | USA | 1 |
| ABC5 | Darla | UK | 2 |
| ABC6 | Lucy | UK | 2 |
| ABC7 | Rebecca | USA | 1 |
| ABC8 | Astrid | Norway | 3 |
Does anyone have any wisdom to suggest what's going wrong? Thanks in advance.
(edits: clarity, spelling)
Solved! Go to Solution.
Hi @NotAHobbyBI
Make sure you are creating a measure not a column, then try
Country Rank =
RANKX (
ALLSELECTED ( Caller[Country] ),
CALCULATE ( DISTINCTCOUNT ( 'Call Occurance'[Call_ID] ) )
)
Hi,
Please check the below picture and the attached pbix file.
I tried to create a sample pbix file like below.
It is for creating a new column.
Country call count CC =
VAR _currentcountry = Caller[Country]
VAR _countcall =
ADDCOLUMNS (
Caller,
"@countcall", COUNTROWS ( RELATEDTABLE ( 'Call Occurance' ) )
)
VAR _groupbycountry =
GROUPBY (
_countcall,
Caller[Country],
"@countcallbycountry", SUMX ( CURRENTGROUP (), [@countcall] )
)
RETURN
SUMX (
FILTER ( _groupbycountry, Caller[Country] = _currentcountry ),
[@countcallbycountry]
)
Rank country CC =
RANKX ( Caller, Caller[Country call count CC],, DESC, DENSE )
Just looking at this solution (it's far more elaborte). Would this route be suitable for workings towards a 'Top N + Others' type solution?
Hi @NotAHobbyBI
Make sure you are creating a measure not a column, then try
Country Rank =
RANKX (
ALLSELECTED ( Caller[Country] ),
CALCULATE ( DISTINCTCOUNT ( 'Call Occurance'[Call_ID] ) )
)
Yep. Was the measure/column difference. I'll go look up why that is.
Thank you!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 32 | |
| 31 | |
| 18 | |
| 12 | |
| 11 |