Hi everyone, this one has me stuck fast.
Data:
Month Total Impact Forecast
------------------------------------------------
2010-04-01 45792.0000 1.0000 NULL
2010-05-01 51789.0000 1.0000 NULL
2010-06-01 58228.0000 1.0000 NULL
2010-07-01 52956.5217 1.0000 NULL
2010-08-01 53600.4700 0.8810 NULL
2010-09-01 54257.8784 1.1838 NULL
2010-10-01 55134.0669 1.0000 NULL
Now what I'm trying to do is loop through the current contents of the table and update the Forecast column using conditional IF statements as follows:
If Impact = 1.0000 then forecast = (current month) total * Impact
If Impact < 1.0000 then forecast = (month -1) total * Impact
If Impact > 1.0000 then forecast = (month -2) total * Impact
I did think of using the CASE statement though calculating the forecast using previous dates stumped me, I presume I will need to utilise a while statements and RBAR.
Much appreciated.