Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Mal_Sondh
Helper II
Helper II

RANKX calculation not working as expected

Hi,

 

I have the following input data:

 

UserCountryURL
AAAUKwww.test.com
AAAUKwww.aaa.com
BBBUKwww.bbb.com
BBBUKwww.zzz.com
CCCUKwww.fff.com
AAAUSAwww.test.com
AAAUSAwww.aaa.com
BBBUSAwww.bbb.com
BBBJapanwww.zzz.com
CCCJapanwww.fff.com
CCCJapanwww.zzz.com
CCCAustraliawww.zzz.com
CCCAustraliawww.zzz.com
DDDUKwww.aaa.com
BBBUKwww.aaa.com
BBBUKwww.aaa.com
AAAUSAwww.test.com
AAAUSAwww.test.com

 

I have created a pivot to show you the results i want to achieve:

 

CountryURL COUNTRANK ORDER
UK81
USA52
Japan33
Australia24

 

RankOrder = RANKX(ALL(SiteVisits),count(SiteVisits[url),,DESC)

 

The results i am getting are as follows:

 

Row LabelsCount of URLGrand Total18

CountryURL CountRankOrder
UK88
USA55
Japan33
Australia22

 

What do i need to add to the RANK calculation to yield the expected result above?

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please make this measure

 

URL Count = COUNT(SiteVisits[URL])
and then use it in this measure
Rank URL = RANKX(ALL(SiteVisits[Country]), [URL Count],,DESC)
 
Regards,
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Please make this measure

 

URL Count = COUNT(SiteVisits[URL])
and then use it in this measure
Rank URL = RANKX(ALL(SiteVisits[Country]), [URL Count],,DESC)
 
Regards,
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks for response @mahoneypat , this looks like it works on the sample data...however when i use it on another similar but larger dataset it doesnt work....

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors