05-20-2022 12:30 AM
Hi
I need to generate the rank for the below data where data should be partitioned by No and Date order by value and want to get the top 3 ranked categories for each No and each Month.
Input :
No Category Date Value Rank
1 Dog 01-01-2022 32
1 Rabbit 01-01-2022 95
1 Fish 01-02-2022 4
1 Ox 01-02-2022 23
2 Cat 01-01-2022 4
2 Mouse 01-01-2022 12
2 Woman 01-02-2022 66
2 Man 01-02-2022 56
3 Bird 01-01-2022 54
3 Bee 01-01-2022 43
3 Cow 01-02-2022 32
3 Pig 01-02-2022 89
Expected Output :
No Category Date Value Rank
1 Rabbit 01-01-2022 95 1
1 Ox 01-02-2022 23 1
1 Dog 01-01-2022 32 2
1 Fish 01-02-2022 4 2
2 Mouse 01-01-2022 12 1
2 Woman 01-02-2022 66 1
2 Cat 01-01-2022 4 2
2 Man 01-02-2022 56 2
3 Bird 01-01-2022 54 1
3 Cow 01-02-2022 32 1
3 Bee 01-01-2022 43 2
3 Pig 01-02-2022 89 2
05-20-2022 01:26 AM
Hi @vaidyarm,
Check this pipeline, does the ranks are correct.
012_Community_Answer_2022_05_20.slp (7.8 KB)
05-22-2022 02:46 AM
will it be applicable if my ranks are not limited to the top 3?
05-23-2022 01:47 AM
Right now not, but if you remove filter function which is inside the “Set Rank” mapper, it will be.
05-23-2022 10:25 AM
Thought the same, thanks for putting in the effort, appreciate it !!