# Counting and restarting

**URL:** <https://forum.knime.com/t/counting-and-restarting/84782>\
**Category:** KNIME Analytics Platform\
**Created:** [November 18, 2024, 8:07pm UTC](https://forum.knime.com/t/counting-and-restarting/84782 "2024-11-18T20:07:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bleck](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/8dc957/32.png) [@Bleck](https://forum.knime.com/u/Bleck)\
**Post date:** [November 18, 2024, 8:07pm UTC](https://forum.knime.com/t/counting-and-restarting/84782/1 "2024-11-18T20:07:32Z")

</div>

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

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/d/c/dcbc98bf0ad417a03b87aeb4d823c626618385d5.png)

and how i need it to look like

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/6/e/6e37ea8962e888706fba0c2ccf8fc10374978eda.png)  
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

---

<div class="post-metadata">

**Author:** ![rfeigel](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/r/7ea924/32.png) [@rfeigel](https://forum.knime.com/u/rfeigel)\
**Post date:** [November 19, 2024, 4:23am UTC](https://forum.knime.com/t/counting-and-restarting/84782/2 "2024-11-19T04:23:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ActionAndi](https://forum-cdn.knime.com/user_avatar/forum.knime.com/actionandi/32/76198_2.png) [@ActionAndi](https://forum.knime.com/u/ActionAndi)\
**Post date:** [November 19, 2024, 5:36am UTC](https://forum.knime.com/t/counting-and-restarting/84782/3 "2024-11-19T05:36:24Z")

</div>

Hi,

this can be done in the following way:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/8/c/8c1923538de285fc2b3d126add26f202c40c7155.png)

- Table creator is used to create your table  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/e/9/e985b4f7ba0cb58ba6045eb31d8541c896b0af0f.png)

- 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](https://forum-cdn.knime.com/uploads/default/original/3X/6/c/6c83fcc1295cda7a7167ebdf873725a198ededd5.png)

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

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

Now the “Group Identifier” is applied to every row:  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/2/22e84ef9d5580eb3d452cae5f2b224a4c6c14c57.png)

- Finally use the “Rank” node to do the counting within the group:  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/8/9/89a9dcf051150003b0733a11e40c3405dae5b04f.png)

Result:  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/5/b/5b56a262e4909c50dd6103223944c18a344e9ce8.png)

---

<div class="post-metadata">

**Author:** ![Bleck](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/8dc957/32.png) [@Bleck](https://forum.knime.com/u/Bleck)\
**Post date:** [November 19, 2024, 11:46am UTC](https://forum.knime.com/t/counting-and-restarting/84782/4 "2024-11-19T11:46:59Z")

</div>

[cumulative count.knwf](https://forum.knime.com/uploads/short-url/3Ht7Z985iqJ9FStVZw5HnYGgkWW.knwf) (8.7 KB)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [February 17, 2025, 11:47am UTC](https://forum.knime.com/t/counting-and-restarting/84782/5 "2025-02-17T11:47:11Z")

</div>

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