Calculate average rates by previous month

I have the spot rate (= Rates) and I need the Average rate.

The average is the current month spot rate (divided by the previous month spot rate. I have the spot rates but don’t know how to write this in math formula in Java. I have from period 1 to 12.

Also I have it for many countries.

Rate Period Average
100 12 100/200
200 11 200/a

a = spot rate actual month / spot month previous month

@ricardo132 welcome to the KNIME forum.

This should certainly be possible to do this. But I have not yet fully understand what your task is. Maybe you could provide us with a sample file and your desired outcome (maybe with dummy data).

You could use group by per month (and country?) and then set the month one month back and join it back to your original data. With KNIME you need not be afraid to use some extra nodes or path to get to your goal.

maybe this?

test.knwf (20.4 KB)

It could look something like this:

It works perfectly, thanks!

1 Like

Just a quick update, I got this flow from a friend. So far I’m using this, it’s the one that works best
(in case someone needs it)Rates12.knwf (9.6 KB)

i don’t know if this will work when you have “periodo” = 1.
if u use an inner join all period = 1 will be lost. switch to left outer join and correct the average in that case



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