Multi-row formula to generate counter based on unique values in other fields

Hi, I’m very new to Knime so am familiaring myself with the functionality based on how I’d use other tools (such as Excel or Alteryx to achieve the same result).

One thing I am struggling with is to create a multi-row formula with reference to itself.

For example, I have the following data:

Col A Col B Counter
A 1 1
A 1 2
A 1 3
A 1 4
A 2 1
A 2 2
A 2 3
B 1 1
B 1 2
B 1 3
B 2 1
B 2 2

Columns A and B already exist, and I want to create a running counter for how many of each there are. So, for example, there are four lines with A 1 in the first two columns, so I want to assign the first line with 1, then 2 etc.

Have tried searching previous topics without much luck, so hoping someone can point me in the right direction. Thanks for any help!

Hi,

you can use the “Rank” Node to achieve this

2 Likes

Thank you! That’s absolutely perfect!

Nice!
Please mark my answer as solution so that others can find it as well.

Andreas

1 Like