Create a waterfall dataset that separates the forecast by future cohort year and existing customers.
Usage
forecast_waterfall(pred, type = c("sales", "transaction"), scenario = 1)Arguments
- pred
Forecast model generated by
fit_forecast_model(). Make sure you have ayearandmonthcolumn present.- type
"sales" or "transactions" to generate the waterfall for.
- scenario
Numeric. Scenario to produce the summary for.
Examples
scenario_predictions$forecasts$year <- rep(2022, 5)
scenario_predictions$forecasts$month <- month.name[1:5]
forecast_waterfall(
pred = scenario_predictions,
type = 'sales',
scenario = 1
)
#> # A tibble: 2 × 3
#> # Groups: year [1]
#> year cohort_year value
#> <dbl> <fct> <dbl>
#> 1 2022 "Existing Customers " 690127
#> 2 2022 "2022" 1547546.