Zero down value in column based on date in cell

Hi
I am new to Knime and I am trying to do forecast model for componets which I need some help getting the forecasted volume in the right months

In the image below I have a table showing the product, the componts in them product, then the volume needed the months columns and each componet has a valid to and From date.
image

What I want to be able to do in Knime is to look at the Vaild to and from dates and then remove the volume from the months its not required. So for example if the Vaild from date is 20th October 2021 I want the volume in July, August and September should be set to zero and if the Valid to date is 20th October 2021 then the October value should be set to zero. As per the screenshot below

image

I have also attached a Excel file showing what I require and hopefully someone canm explain how I can do this in Knime

Thanks

Hi @Slacktyson , welcome to KNIME Forum

In your valid from and valid to dates I see years e.g. 31/12/2099. Are your month also related to years. Is July => July 2021 and is there also a July 2022 … 2099. Or do you have only 12 columns (Jan - Dec), without a year (in that case the year in valid from/to is not relevant)?
gr. Hans

Hi Hans,

Thanks for your reply. I have only 12 columns one of each month so the year is not relevent

Thanks

1 Like

Hi @Slacktyson

I created this wf zero down value.knwf (64.1 KB) . It uses a Column List Loop for every month. By using the current-iteration from the loop (flow variable), you are able to compare the valid from/to month with the month-number of the current iteration (see the rule engine). This workflow requires that your columns with the values per month are properly ordered (Jan, Feb, Mar (…) Dec). Take a look and see if it works for you.


gr. Hans

2 Likes

Hi @HansS

Thanks for the work flow its almost doing what I need

The forecast I am working on is based on a fiscal year running July to June so I tried to reorder the columns Jan to Dec but this did not work. I know I said earlier that the year was not relevent but looking at it again I think it is so is it possible to bring the year into this work flow as well?

Thanks again

Hello @Slacktyson,

have you had any success with your task? I think unpivoting, apply logic, pivoting approach can help. Take a look at example here:

If you have any sample data you can share I can try and make example for you. (Dummy data works just fine). Welcome to KNIME Community!

Br,
Ivan

2 Likes

Hi @ipazin

Thanks for the help that worked great unpivoting and pivoting

KR

David

3 Likes

Glad to hear that @Slacktyson.
Ivan

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