The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi, I have been trying to solve this problem on PowerBI for the past hours but nothing seems to work. Here is my script:
Where are you plotting to? Your code is missing the reference to the built-in plotting library.
I have modified my code to this:
# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:
# dataset <- data.frame(Year, Sales revenue (£m))
# dataset <- unique(dataset)
# Paste or type your script code here:
# time series forecasting
dataset <- unique(dataset)
library(forecast)
# Assume the data starts from the first year available and increments yearly
sales_ts <- ts(dataset$`Sales revenue (£m)`, start = min(dataset$Year), frequency = 1)
# Fit an ARIMA model
fit <- auto.arima(sales_ts, seasonal = TRUE) # If seasonality might be a factor
# Forecast the next 5 years
future <- forecast(fit, h = 5)
# Plot the historical data and forecasts
plot(future)
This the plot:
I'm not sure why there is a gap between the historical data and the forecast
User | Count |
---|---|
40 | |
15 | |
13 | |
11 | |
8 |
User | Count |
---|---|
47 | |
43 | |
23 | |
19 | |
18 |