Breaking Ties in a Rank

I am trying to create a rank function over a list of names and encounters. Is there a way to break the ties? Similar to the row_number() function in excel, but I can’t get the denserank or rank function to break ties.

Example data:
Person A 56
Person B 56
Person C 52
Person D 51

I would like to break the tie between person A and B using a different field in my data set or even just randomly choosing one to show up would work as well.

Hello there,

You can break the tie by creating a calculated field that uses multiple sort fields in your rank function.

Syntax

rank
(
[ sort_order_field ASC_or_DESC, … ]
,[ partition_field, … ]
)

Example

rank(
[max({ Data}) DESC,Name ASC]
)

1 Like