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
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

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.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors