###### Technical Articles

# Predictive Planning What-If Simulation in SAP Analytics Cloud

# Introduction

In a previous blog post I presented the new *Influencers* feature for Predictive Planning. We focused mainly on using the influencers to increase the accuracy of the predictive forecasts.

Specifically, I have mentioned that when using some influencers that are not under your control, because you can’t know the future values for sure, you must generate multiples forecasts based on different scenarios. Sounds familiar? You have probably recognized a What-if simulation.

The What-If simulation is used in a planning context to determine what would be the value of a KPI based on different hypothetical business scenarios.

- What would be my revenue this year if I make the same discounts as last year? What if I make no discount?
- How would my expenses be impacted if travel restrictions would continue due to the COVID-19 situation? What if the restrictions are lifted?
- What if the marketing budget is reduced? How would that affect my sales.
- What would be the number of bikes hired tomorrow in my city if it is not raining? What if it is raining?

In this blog post we will show you how you can leverage SAP Analytics Cloud Predictive Planning predictive capabilities to perform a predictive “What-if simulation”.

# How Does Predictive Relate to What-if Simulation?

## The Simulation Model

To understand how the “Predictive What-if Simulation” differs from a traditional What-If simulation, we need to have a quick look at the method behind the What-If simulation.

To perform a What-if simulation you need:

- Some business variables: the business variables are KPIs (Key Performance Indicator) associated to your business.
- Some scenarios: the scenarios are the different business hypotheses you want to test. Each scenario corresponds to a set of values you want to test for the business variables to see how it impacts the KPIs to be estimated. “What-if I would increase the advertisement budget by 10% next year and maintain the same discount” would be a scenario, “What-if I would decrease the advertisement budget by 10% next year and make no discount” would be another scenario.
- A simulation model: the simulation model expresses the relations that exist between the business variables. It’s a simplified representation of your business.

Usually, the simulation model would be the *Planning Model* itself, where you have expressed explicitly (by creating hierarchies or calculations) the relations that exists between the measure/accounts (the business variables). But this approach is applicable only under the following conditions:

- the relations between the business variables and the outcome to be estimated must be known and must have been properly expressed in the planning model
- the relations between the business variables and the outcome doesn’t change over time

The *Predictive Model* can find relations between the business variables and the KPI to be predicted that may not be expressed in the *Planning Model*. Moreover, these relations are reevaluated each time the *P**redictive Model* is retrained. The *Predictive Model* can be used as a complement to provide additional relations between the business variables and the KPI and thus have a better simulation model.

## Example

Let’s assume you are selling cars and you would like to get an idea of your revenue for next year.

You have a* Planning Model* with the following KPIs:

*Revenue*(the KPI you would like to estimate with the simulation)*Number of Units Sold**Unit Price**Discount**Advertisement Budget*

*Revenue* is certainly expressed explicitly in the *Planning Model* as a function of *Number of Units Sold, Unit Price* and *Discount (*something like* Revenue = Number of Units Sold * Unit Price * Discount *to simplify*)*. Because this relation exists explicitly in the *Planning Model* you can easily simulate how changing Discount and* Unit Price *would impact the* Revenue*.

But this* Planning Model* also contains relations that are not expressed explicitly. It’s safe to assume that *Discount* and *Advertisement Budget* are impacting *Number of Units Sold *(that’s usually why you make discount and advertisement). But these relations would usually not be expressed in a *Planning Model*, so there is something not completely right in your simulation: changing the values for *Discount* and *Advertisement Budget *has no impact on *Number of Units Sold*.

So, to fix your simulation you can use a time series forecasting model to predict *Number Of Units Sold* using *Advertisement Budget* and *Discount* as influencer. This way the missing relations are modelized and can be used as a complement to the relations that exist in the *Planning Model*.

These new relations brings two advantages:

- You can take into account the impact of variables that were previously not considerd in the simulation:
*Advertisement Budget* - You don’t have to provide a value for a variable,
*Number Of Units Sold,*which is not under your control, to run your simulation. Instead you provide values for variables which are under your control:*Unit Price*and*Advertisement Budget*

# Scenario

The remaining of this post is assuming that you are familiar with *Predictive Planning* and the *Influencers*.

To learn more about using *Predictive Scenarios*, please refer to this blog post.

To learn more about using *Influencers*, please refer to this blog post.

I am working for a company that is renting bikes in London. I have a planning model that contains a *BikeHires* measure that counts the bike hires done each day. The planning model also contains several measures related to the weather. Using *Predictive Planning* I would like to forecast the number of bikes that will be hired for the coming 30 days.

You can download this dataset if you want to recreate this example. Note that the columns *BikeHires*, *Temp. Min*, *Temp. Max*, *Temp. Mean*, *Humid. Min*, *Humid. Max*, *Humid. Mean* and *Rain* are expected to be measures. Other columns should be considered dimensions.

You can refer to this blog post if you need help to create a planning model from a CSV file.

# Step by Step

## Simulation Scenarios

In an earlier blog post we have seen that the number of bike hires is influenced by some weather related conditions, more specifically, the amount of rain and the maximum temperature during the considered day.

But we want to get predictions for the 30 coming days. We can probably have some rather precise weather predictions we can use for tomorrow, possibly even for the full week to come if the imprecision doesn’t matter too much… but there is no way we can get any weather forecast we can trust for the 30 days to come. In all cases we would be using unreliable input to generate predictive forecasts.

So, what should we do? We should perform a predictive “What-if” simulation, that is looking at what the predictive output would be based on different hypothesis, knowing that they are just hypothesis. Because the predictions are based on input that are themselves not predictable, we don’t make assumptions about what the future will be. Instead we look at what would happen in such or such situation.

We will perform a What-if simulation using 3 simple scenarios (“hypothesis”):

- A
**median**scenario that will allow generating a forecast based some standard assumptions about the weather. - A
**pessimistic**scenario that will allow generating a forecast based on pessimistic assumptions about the weather (weather conditions that tend to lower the number of bikes hires) - An
**optimistic**scenario that will allow generating a forecast based on optimistic assumptions about the weather (weather conditions that tend to increase the number of bikes hires)

## Setup the Scenarios

Each simulation scenario will be represented as a planning version, so we need to create 3 private versions.

But to create these versions we need to take a SAP Analytics Cloud Predictive Planning limitation into account: it’s not possible to train a model once and apply it to multiple versions. This means that we will have to train 3 distinct models using the same training data each time. So simply we will create our 3 versions by copying the data from the Actual version.

To keep things simple, we have assumed a constant daily maximum temperature and a constant daily amount of rain over the whole month. But you can create way more complex scenarios if you feel the need to.

Where do these values come from?

Over the past years the average temperature in September was 15C, with a minimum average temperature of 12°C and maximum average temperature of 18°C. So, we took 15°C for the median hypothesis, 12°C for the pessimistic hypothesis and 18°C for the optimistic hypothesis.

Similarly, the average daily amount of rain in September is 1.5 inch and it’s around 5 inches on an awfully bad month. So, we took 1.5 inch for the median scenario, 5 inches for the pessimistic scenario and 0 inch (no rain at all) for the optimistic scenario.

## Train the Predictive Model

Now we will create a time-series forecasting Predictive Scenario.

Let’s create a first Predictive Model for the “median” scenario, using the settings below:

Don’t forget to provide a description that identifies the simulation scenario clearly.

Train the model:

The two remaining predictive models will use the same settings but reference other input versions, so we will use the “Duplicate” feature.

Create 2 additional predictive models changing only the input version and the description. Train these models.

Now we have 3 trained models, ready to generate prediction for 3 distinct scenarios.

We just need to write the forecasts for each of the model to a different version. To avoid multiplying the versions, we will write the forecasts of each model to the planning version that was used to train the model.

Click the “Save Forecast” button.

## Visualize the Results

Now, we are ready to visualize the results of the simulations into a story.

We can see what the bike hires for September could be for three hypothetical scenarios. It gives us as sense of what to expect if the weather in September is very bad, very good or average.

# Conclusion

In this blog post, you learned how to leverage the Influencers to perform simulation planning. The example we used was focused on how to generate predictive forecasts when the influencers are not under your control. Using the exact same methodology, you could perform a simulation to determine the best value for a set of KPIs that are under your control. For instance, you could use what you have learned in this post to determine what would be the best advertisement budget for next year (if the advertisement budget has an impact on your sales).

I hope this blog post was helpful to you. If you appreciated reading this, I’d be grateful if you left a comment to that effect, and don’t forget to like it as well. Thank you.

Do you want to learn more on Predictive Planning?

- You can read our other blog posts.
- You can also explore our learning track.
- You can also go hands-on and experience SAP Analytics Cloud by yourself.

Find all Q&A about SAP Analytics Cloud and feel free to ask your own question here: https://answers.sap.com/tags/67838200100800006884

Visit your community topic page to learn more about SAP Analytics Cloud: https://community.sap.com/topics/cloud-analytics

Hi David,

Thanks for this post - I thought it was excellent. A very clear explanation and example of the difference between planning models (even sophisticated driver based planning models) and predictive models, of the scenarios in which they might be used, and how they might complement each other in a planning process.

Thanks,

Hugh

Hi Hugh, thanks very much for the feedback. We also consider this a very fruitful scenario to leverage the full potential of Predictive Planning in a business context that's could be considered more uncertain than ever.

Happy to discuss any next steps you might want to look into.

Best regards,

Antoine

Enjoyed reading this blog. Now I have the idea on how to leverage influencer to do the What-If simulation