cancel
Showing results for 
Search instead for 
Did you mean: 
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
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors