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
hcova
Frequent Visitor

Why Rank() has a discontinuity

Hi,

Below I include a simple table called "Data" and a pivot table called "TD1".

I calculated the total P/L per Seller and I tried to rank it using MyRank measure based on Rankx() function.

 

Question : Can anybody explain me why using Rankx() doesnt show a continous ranking?

For instance, in the pivot table, under the MyRank column, US group, the  #5 ranking is not shown (lost).      In CAN group, #6 ranking is lost.!!!

Regards

 

Rankx() discontinuity.jpg

 

1 ACCEPTED SOLUTION

Thanks a lot.
You are right!!
Regards

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @hcova

 

The problem in this case is that the table that RANKX is iterating over, namely ALL ( Data[Seller] ), includes all Sellers, even those that don't exist in the currently filtered Country.

 

The value of [Total P/L] for these these sellers is BLANK, which RANKX treats the same as zero. However you don't see these customers in the PivotTable because only existing combinations of Country/Seller are shown for columns from the same table.

 

In order to exclude these customers from the ranking, you could rewrite your measure like this, which will eliminate the "skipped" ranks:

Rank Fixed =
RANKX (
    CALCULATETABLE ( VALUES ( Data[Seller] ), ALL ( Data[Seller] ) ),
    [Total P/L],
    ,
    ASC,
    DENSE
)

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Thanks a lot.
You are right!!
Regards

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.

Top Solution Authors