Counting and restarting

Hello Knime

i have a table hundreds of workers but in the end i need one last info where it counts how many consecutive days of work they had
here is an example of the table

and how i need it to look like


it does not need to look exactly like that but as close as possible
i did try to find on other forum questions but i was not able to find a good way to fix this
thank you for your time

You’re more likely to get help if you upload some sample data.

Hi,

this can be done in the following way:

  • Table creator is used to create your table
    image

  • Lag column lags column “B” by one

  • Rule-based Row Filter removes all entries were B=B(-1)

  • Counter Generation creates a Group identifier / you can use “math node” also
    image

  • Left join on “RowID” in the joiner node, keep “Counter” column from right table:


    image

  • forward fill the missing values in the “Missing Value” Node:

Now the “Group Identifier” is applied to every row:
image

Result:
image

5 Likes

cumulative count.knwf (8.7 KB)