I would like to create a counter that reset to 1 when the value in a row change.
for example when proposal_id or category change then the row counter should restart to 1
proposal_id, category, row_counter
1, A, 1
1, B, 1
1, B, 2
1, C, 1
1, C, 2
2, C, 1
2, C, 2
2, D, 1
3, A, 1
3, A, 2
3, A, 3
4, A, 1
Using the idea from here:
The new_counter column is what’s been generated.
You can achieve the task with a single node by using ‘Rank’ node.
The node can be configured with the option ‘Ordinal’ by using Grouping Attributes section.
Thank @elsamuel works great
At the end it’s necessary an extra column that can be ANY (could be the INDEX, a copy of your category column…), this happen because your logical OR condition on the column counter change.
Therefore, aiming to configure the ‘Rank’ node you need to include both columns in the ‘Grouping Attributes’ section, and the node doesn’t allow to rank a column that’s been already included in the Group; in this case I will use the starting created one (instead a combiner or aggregation).
But as summary, no looping is needed in this task.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.