Forum Discussion
Suman8877
11 months agoAdvocate II
I need TOPN customer ?
Hi, There are slicers for Region, Country and, Reporting Unit in Power BI report and I need to show top 5 customers from TodaysTable data based on the selection made. Table structure: HistoryTabl...
- 11 months ago
Hi Suman8877
The RANKX function works based on the field you are grouping by.
For example:
Rank of Customer = RANKX( ALLSELECTED(TodaysTable[Customer]), [Todays Revenue], , DESC, DENSE )This calculation ranks values at the Customer level.
- If you want to rank by a combination key (such as Region + Country + RU), you need to replace Customer with that combination key.
- If your report has separate columns for Region, Country, and RU, this approach can produce incorrect results.
- The key principle is: the dimension you use in your visual should be the same dimension you use inside RANKX for accurate ranking.
rohit1991
11 months agoSuper User
Hi Suman8877
The RANKX function works based on the field you are grouping by.
For example:
Rank of Customer =
RANKX(
ALLSELECTED(TodaysTable[Customer]),
[Todays Revenue],
,
DESC,
DENSE
)
This calculation ranks values at the Customer level.
- If you want to rank by a combination key (such as Region + Country + RU), you need to replace Customer with that combination key.
- If your report has separate columns for Region, Country, and RU, this approach can produce incorrect results.
- The key principle is: the dimension you use in your visual should be the same dimension you use inside RANKX for accurate ranking.