Trouble calculating starting and ending headcount using a Loop

Hi @hmfa, you recently helped me with fixing an issue around calculating starting and ending headcount using the loop node. Thank you for that!

It seems like i’ve run into a problem though when I add January data. It’s not able to calculate the ending headcount value correctly and i believe it has something to do with the fact that the year has changed from 2023 to 2024. So the group start loop node is unable to include 2023 and 2024 in the loop, so it can’t cumulatively calculate the “value_add” amount.

Here’s an updated csv file with the current and desired output. Would you mind looking at the solution you built and helping me figure out a fix for it?

Sample Data.csv (659 Bytes)

here’s the last workflow you created, for your convenience.

Trouble calculating starting and ending headcount.knwf (92.9 KB)

Hello @sheidari81.

Thanks for informing me that the solution no longer works because of the year change.
I’ve converted the year to numeric, and included a fake group column for the loop.
I hope that this solution will last through the new millennium :wink:.


Trouble calculating starting and ending headcount2.knwf (93.6 KB)

Can you confirm that the 2024 jan starting value is the 2023 dez end value?

Glad to help you.
Best regards

1 Like

It’s working now! Thank you.

Yes, the january '24 starting value is the dec '23 ending value!

1 Like

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