Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to get a working time series forecast in Qlik Sense. At first I tried the Advanced Analytics Toolbox, but the time series components of that extension are broken and do not work as intended. I was able to do the analysis that I wanted in R Studio as a proof of concept, and now I want to reproduce the results in Qlik Sense. The goal is to get ARIMA forecast predictions for each future month.
I have been able to get simple R scripts to work such as:
R.ScriptEval('variable = q$test; variable',
Sum([REVENUE]) as test
)
and the data is properly sliced by the dimension in the line graph.
I have written the following analysis in R which correctly creates and ARIMA model and forecasts future periods:
library(forecast)
library(ggplot2)
#Monthly
arima = read.csv("diagm.csv")
vals = arima$rev
vals = as.numeric(vals)
tsobj = ts(vals, start = c (2014, 10), end = c(2018, 5), frequency = 12)
##ARIMA
ar = auto.arima(tsobj, ic = "bic")
ar
fc = forecast(ar, h = 12)
fc
autoplot(fc) + ggtitle("Monthly Revenue Forecast") + xlab("Month") + ylab("Revenue") +
scale_y_continuous(labels = scales::comma)
By dissecting the code of others I think that my Qlik Sense R script is close, but it is not yielding results. Right now my best try is:
R.ScriptEval('
library(dplyr);
library(forecast);
data = ts(na.omit(q$Measure), frequency = 12);
fit = auto.arima(data);
res = forecast(fit, h = 12);
as.double(res$mean)',
Sum(REVENUE) as Measure
)
Please let me know if you are familiar with forecasting with R in Qlik Sense or if my coding errors are apparent.
Thanks!
Hello Elliot, I have been trying the same with unfortunately very dismal results. Could you tell me what error the R server is showing when you're applying this script? Also, please share the dataset if you can.