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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
DaveAl
Frequent Visitor

RANKX Circular Reference Help

Hi All,

 

I feel like this one should be really simple, but I can't seem to work it out. I have a very basic, static table with a persons name and a score. I would like to rank those score within the individual. Example:

 

Dataset:

PersonScore
John50
John75
John50
John100
Tom50
Tom75
Tom100
Tom100
Dave50
Dave75
Sally50

Desired Result:

PersonScoreRank
Dave502
Dave751
John503
John503
John752
John1001
Sally501
Tom503
Tom752
Tom1001
Tom1001

 

If I use Rank = Rankx('Table','Table'[Score],,DESC,DENSE) it will rank all of the scores, not bound to an individual. 

 

If I use Rank = Rankx(ALLEXCEPT('Table','Table'[Person]),'Table'[Score],,DESC,DENSE) then I get a circular dependancy error. 

 

Am I missing something obvious here? I feel like I am...

 

Thanks again for all your help!

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

The ALLEXCEPT function is a bit weird when used as a table function. I you're trying to write a calculated column, I'd suggest this version instead.

 

RANKX (
    FILTER ( 'Table', 'Table'[Person] = EARLIER ( 'Table'[Person] ) ),
    'Table'[Score],, DESC, DENSE
)

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

The ALLEXCEPT function is a bit weird when used as a table function. I you're trying to write a calculated column, I'd suggest this version instead.

 

RANKX (
    FILTER ( 'Table', 'Table'[Person] = EARLIER ( 'Table'[Person] ) ),
    'Table'[Score],, DESC, DENSE
)

Hi AlexisOlson,

 

Works like a charm! Thank you for the assist. 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.