Generate a row for each week during a given time interval

I have a dataset that contains one row for each product. In each row, there is a date column which signifies the start of a certain testing phase, and a date column which signifies the end of that testing phase.

In order to enable weekly capacity planning, I want to generate a row for each week in that given time interval.

Here’s a short example for better understanding:

product start of testing end of testing
x 01/03/2020 15/04/2020
y 25/01/2020 10/03/2020
z 09/06/2020 18/08/2020

should result in

product start of testing end of testing Week
x 01/03/2020 15/04/2020 2020_09
x 01/03/2020 15/04/2020 2020_10
x 01/03/2020 15/04/2020 2020_11
x 01/03/2020 15/04/2020 2020_12
x 01/03/2020 15/04/2020 2020_13
x 01/03/2020 15/04/2020 2020_14
x 01/03/2020 15/04/2020 2020_15
x 01/03/2020 15/04/2020 2020_16

Is there any possibility to do that?
I tried to find a solution with some kind of loop, but I did not find any possibility to end the iterations within the given time frame.

Thanks a lot in advance!

Hello Tamara.

I have tried to play around with your example. Take a look. forum.knwf (40.8 KB)

Maybe in the end of the day not so many manipulations will be needed, depending on actual output format you need.

1 Like

Thank you so much, this is very helpful!

Nice one!
I took the challenge and simplied the workflow with less nodes.

Cheers, Iris GenerateWeeks.knwf (33.8 KB)

1 Like

Thank you so much. It works now for little datasets, but with large ones it takes like forever. Is there any possibility to speed it up and improve performance?

Thanks a lot in advance!

I tried something else, which does not use a loop.
I generate all rows, than join and finally filter it down. All inside a streamed wrapped metanode.

However, I am filtering one row too much, so if someone wants to check where my problem is, see the workflow attached. GenerateWeeks-Faster.knwf (33.7 KB)

Cheers, Iris

1 Like

I think i have managed to find what was the issue. The definition of full week had to be introduced in order to calculate correct week intervals. So the start dates had to be aligned with the first day of the corresponding week.

Please, take a look.

GenerateWeeks-Faster-Fixed.knwf (34.3 KB)

I hope that helps.