Pick highest value from row based on a different column

Hello -

In this table, how can I pick the larger of the Col2 value?

e.g.

  • compare the 1st two rows in Col1. If they are equal, pick the “larger” of Col2. answer = at02577r01t
  • compare the next two rows in Col1. They are not equal. move on
  • compare the next two rows in Col1 (row2 and row3). Equal. Pick “at02587r01t”
  • etc…

final output should not have any duplicates in col1…

Thank you.

image

Test.knwf (4.5 KB)

You can either use

  1. GroupBy Node using Col1 as grouping column and the maximum of Col2 as aggregation.
  2. A Duplicate Row Filter with Col1 as duplicate column and as extra condition the maximum of Col2.

Both methods rely on string comparison to pick the “bigger” value. If you have more than 2 columns in your actual data set, the Duplicate Row Filter will be the better choice.

Thank you very much for providing sample data, it makes finding a solution a lot easier!


Test.knwf (17.0 KB)

4 Likes

Thank you, @Thyme! Appreciate your help.

1 Like

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