1 Reply Latest reply on Nov 24, 2017 7:06 AM by mircea.rusu.0

    Forecasting with R script doesn't work correctly, it's changing my value in the past

    Manoel Burgos Filho

      Hi Everybody!


      I am facing a problem that I tried many different approaches but no one worked for this case.


      I created this .twb, and I would like to forecast values beyond September 22. For instance, I created a parameter called 'Days Ahead' which is used to increment how many days for forecasting.

      However, all the time when I try to forecast, my chart line shows a value for the future (this ok), and also changes my values from the past (not ok).

      So, my forecasting line which appear as a different colour, instead just show a future value, it is showing and changing my values from the past and make these results part of the final forecasting.


      Technical part:

      I created a Calculated field calls 'Forecast_Ets-RESOLVED':


      IF ([Days Ahead]=0) THEN




      time <- ts(.arg1,start=c(2013,1), frequency=12);

      fcast <- forecast(time, h=.arg2[1]);


      append(.arg1[(.arg2[1]+1):n],fcast$mean, after = n-.arg2[1])",

      [RUNNING_RESOLVED],[Days Ahead]+1)



      Also, I created a Dimension field called 'dateForecast'

      dateadd('day',[Days Ahead],[Date])


      Furthermore, I created a measure field (calculated field) called 'ActualvsPredicted'


      IF INDEX() < SIZE() - ([Days Ahead])

      THEN 'Actual'

      ELSE 'Forecast'



      Could you share an idea how to solve it, which means, just show future values instead to change my past values?