cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Implementing RANK function

Preeta
New Contributor II

Hello,
I am trying to implement the RANK function similar to what we have in sql. Rows with equal values for the ranking criteria should have the same ranks and ranks might not be consecutive numbers. For example, if two rows are ranked 1, the next rank is 3.
Here is the output I am expecting , I have attached the input pipeline. i have got the consecutive ranks but not able to figure out how to eliminate the ones which are same.

key name date rank
ABC Orange 8/1/2018 1
ABC Orange 10/1/2018 7
GEF Apple 10/1/2018 1
GEF Apple 11/1/2018 3
SampleRankJob_2019_09_24.slp (13.8 KB)

Thanks ,
Preeta

1 REPLY 1

dimitri_hristov
Contributor

Hi,

I took the pipeline youโ€™ve attached, and Iโ€™ve extended it with a few snaps. Basically, I group the documents once more, and then I take the first element from each group. Then I sort the documents. Hereโ€™s the extended pipeline: SampleRankJob_Extended_2020_05_28.slp (12.1 KB)

BR,
Dimitri