PowerBI Auto Arima Forecasting

Hello,

I am new to R and was asked to create a forecast in PowerBI. I found a helpful video on youtube to follow and wrote out the code below. However, I keep getting this error.

Has anyone used forecasting with R Script in PowerBI?

Below is the code:
library(forecast)

dataset <- aggregate(dataset$category_value, by=list(dataset$complaint_status_date),FUN= length)
names(dataset) <- c('complaint_status_date','Count')
dataset$complaint_status_date <- substr(dataset$complaint_status_date, 1,10)

ts <- ts(dataset$Count, frequency= 7) # frequency 7 to predict for the next 7 days

arima.ts<- auto.arima(ts)

pred <- forecast(arima.ts,h = 7) # preditcts for the next 7 days

#gives the actual dates
d <- dataset$complaint_status_date
dl <- d[seq(1, length(d),7)]

plot function for predictions
SetWD()
plot(pred,axes = FALSE,
main = 'Category Forecast for the Next 7 Days')
axis(2)
axis(1,
at = seq(1:(length(dl+ 1)),
labels = (c(dl,'pred')),
cex.axis = 1) # change to labels defined above

1 Like

R is case sensitive, the command is setwd() not setWD()

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