If you want a column formula this should work. Independent of sorting.
Local( {L = Associative Array( :Label ) << get keys}, Loc( L, :Label ) )
Same approach could be used in JSL without a column formula.
dt = Current Data Table();
dt << New Column( "Rank Unique", continuous );
L = Associative Array( :Label ) << get keys;
For Each Row( :Rank Unique = Loc( L, :Label ) );