Month to Month calculation problem

Hello all

Got stuck on a problem. After some initial processing, my data now looks like this:

Now comes my issue. I need to calculate the percentage change from January to February, from Feb to March and so on.
I can obviously do the calcs with the Math Formula node, but I need to make it work all year long, and those months don’t exist yet.
Sample of math formula output:

The formula is a simple Perc calc:

Any help in solving this is greatly appreciated, currently drawing a massive blank.
Tried Transposing, Unpivoting, Multi column Math … I couldn’t make any of them do what I need.
Thanks.

It would be a lot easier to help if you would provide sample data. My gut feel is transposing and then using the Expressions node will work.

Hi @Vikkykaushal

Welcome to KNIME Forum. I created this wf month_to_month_calculation.knwf (96.7 KB) . It uses a Window Loop with a window of 2 and a stepsize of 1 to loop over the two columns to calculate.

.

Gr. Hans

2 Likes

you can always create blank columns if you know they gonna “appear” sometime in the future.
you can also address columns by their index.

given we are approaching years end, I would also spend a bit of time checking, how years end are being handled:

  • everything consecutive in one worksheet? then expect people to start renaming columns or even re-ordering them eventually
  • everything in one file? expect additional worksheets to appear
  • split per year? then you may need to pull December of PY to calculate the difference for January CY
1 Like