Select first "n" records per group

Hi guys,
I wonder the way could be followed to select the first 3 rows with the highest values in each group.
(the group is the value in a column, i.e. worker name). In alteryx you could do that by using the “select” Tool

I guess you could do that using a loop workflow, but I would like to know if you could achieve the same using some knime node.

thank you.

To my knowledge there is no single KNIME node that will do this.

You’d need a loop: Group Loop > Top k selector > End Loop


First you do a ranking based on the group (or groups) with the ranking node. Then you use the top k selector as @elsamuel proposed
Maybe that works for you

1 Like

Edit I think you just need to filter the top k using row filter after the ranking

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.