Ranking without skipping numbers for duplicates?

I’ve got a set of data that I’m ranking by a particular column. Some rows have the same value for this column, so they get the same rank as each other, which is good - I want that.

Issue is, when duplicate ranks occur, it adds the number of the current rank’s duplicates to all successive ranks.

Not feeling good about how well that came across, though, so here’s an attempt at an example.

Lets say I want to rank by this data:
[ A, C, B, B, A, B, D ]

Doing so with Rank(thisRow.column, thisTable.column, true) returns workable values, except when there are duplicates. In this case, I’d get: [ 1, 6, 3, 3, 1, 3, 7 ]

There’s two rows with the value “A”, so the next possible rank (“B”) gets pushed back. It becomes rank 3, instead of rank 2. And because there are three matches for “B”, the next one along (“C”) is pushed by back another 3, making it rank 6 instead of rank 3.

Basically, I get:
[ 1, 6, 3, 3, 1, 3, 7 ]
When what I want is:
[ 1, 3, 2, 2, 1, 2, 4 ]

And I’m not sure how to achieve that.

Hi Angus, welcome to the community.

Replace
Rank(thisRow.column, thisTable.column, true)
with
Rank(thisRow.column, thisTable.column.Unique(), true)

to get continuous rank values

2 Likes

Wow. That was easier than I expected. Thanks. :+1: