Removing negative dates and/or splitting date periods

Hi all! :sunny:

Maybe one of you has a smarter way to manipulate dates for the desired result. On the left, I have raw data which contains start and end dates. However, some rows have negative values in the Units column, which means that the mentioned date has to be deleted from the same Name and the date period has to be adjusted. On the right is an example of how the data should look.

I was thinking of splitting the periods to create dates in between, and later sorting out negative values, changing them to positive, concatenating tables, and removing duplicates. But if there’s a smarter way to do this, please help me out! If not, I’d appreciate help with splitting periods and creating dates in between.

Please keep in mind that Name, start and end dates, and unit quantity can vary significantly each time.

Thank you a lot!

data example.xlsx (9.2 KB)

Hi @businesssun , using a strategy similar to, but not quite the same as, the one you describe, this is a method of doing this (assuming my understanding of the rules is correct) which incorporates a loop.

It can also probably be done without a loop, which would make it a bit faster (especially on larger data sets), but how easy that is to do depends on specifics of your data. For now though, here is the loop version which was easier to build :wink:

Removing Date ranges 1.knwf (46.6 KB)


Hi @takbb, thank you so much for your help! I tried to create the workflow with loops, but my knowledge of this part of KNIME is limited, so I truly appreciate your assistance. :pray: Your solution worked perfectly. :clap:

1 Like

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