# Predictive Analysis on HANA Cloud Platform and Sales & Operations Planning ( S&OP) Statistical Forecasting

The purpose of this blog is to demonstrate the predictive analysis capability using HANA Cloud Platform & will use S&OP tool’s statistical forecasting capability as an example of predictive analysis.

Predictive analytics have been around for many years however with HANA technology these are more easily available for usage .

Analytics versus Predictive Analytics

Business Intelligence (BI) tools like BW do a good job of slicing and dicing data to help answer questions such as what happened or what is happening, and facilitates analyzing why it happened.

With predictive analytics, users can estimate outcomes (often called targets) of interest. Outcomes might include: Who will disconnect a service? How much will something increase in value? Predictive analytics is deeper, more proactive, and doesn’t require a predefined cube data structure.

An analytics example to determine Top 10 Customers is fairly easy to achieve using BI analytics tools, however with the HANA Platform, there’s no need to store aggregated sales figures separately in addition to sales transaction data, as HANA in memory calculation views can do the aggregations on run time as shown in the analytics below.

Image of Top 10 customer’s analysis done on HANA Cloud Platform Application

A similar analytic & chart is quite easy to be defined by selecting, attributes, master data, time profiles and key figures and could even be made part of user dashboards in S&OP Tool as S&OP Tool leverages the in memory calculations & aggregations possible in HANA.

However, if Analytics for “ABC analysis” needs to be performed on the sales transaction data, for example as shown in the image below, if an organization wants to know which are its top 20% companies/customers responsible for 70% for their sales , & top 30% companies/customers responsible for 20% of their sales and top 50% companies/customers responsible for 10% of sales, then building such analytics on HANA is fairly easy compared to BI tools as predictive capabilities native to HANA could be leveraged for processing & deep analysis of data in a responsive manner.

Image of ABC analysis done on HANA Cloud Platform Application.

Above example illustrates that Predictive analysis involves methods and technologies for organizations to spot patterns and trends in data & mine data for unexpected insights, which traditional analysis cannot address .

Predictive analysis can achieve a range of desired business outcomes, including higher customer profitability and more efficient and effective operations as predictive analysis not only provides the Business User the same view of actual data that BI tool provides, but it has the additional capability of predicting the future data patterns based on the existing data.

Predictive analysis can even predict or recommend items that could also be sold/consumed by customer by doing association analysis on shopping cart or basket , commonly used in the Retail industry for cross selling. (Think Amazon.com – “customers who bought item X also purchased items Y and Z” based on other customer buying patterns and your own buyer history.”) .

**Predictive Analysis and S&OP Statistical Forecasting**

Predictive analysis is used by the SAP Sales and Operations Planning (S&OP) tool which can generate forecasts for various business scenarios, whether it is quantity forecast or price or revenue forecasts. These forecast values are achieved by manual request or scheduled requests to run Statistical forecasting through S&OP add-in for Microsoft Excel. S&OP Statistical forecasting uses time series algorithms which are part of Predictive capabilities native to SAP HANA.

The settings for these algorithms are maintained in S&OP configuration for Statistical Forecast Profiles and Methods parameters. S&OP automatically picks the best forecast method and best parameters i.e. one with least error , for a given input data.

In order to understand better how S&OP uses statistical forecasting to predict future quantities or prices or revenues , below are the results from a custom developed SAP HANA Cloud application used primarily as a Statistical forecasting test tool. It uses the same predictive analysis library functions in HANA which S&OP Statistical forecasting uses.

It uses the single sign-on capability of SAP HANA Cloud Platform and provides a visual way to test & present the forecasting process results.

Quantity over time is called time series, and predicting the future value based on existing time series is also known as forecasting.

These time series algorithms help in predicting the future values, & these can be used in many other business scenarios, including predicting stock value in future. Statistical forecasting is used to smooth the existing time series and forecast, & predicted values should mirror close to actual values to indicate a good fit.

Last 24 months history of actual units sold is being used as data for Statistical forecasting of future demand.

Units sold depicted in the image chart below are aggregated quantity values by calendar month for a given planning level. ( i.e. business scenario can define it for any product or family or customer class and for any combination of master data attributes ). Such Data set in CSV or comma delimited format can be easily extracted from S&OP Add-in for excel by creating a planning view or with HANA Cloud Integration – Data services tool .

Single exponential smoothing is a commonly used algorithm that uses a Smoothing factor value (ALPHA), which is between 0 & 1. It allows fine tuning in the smoothing process. The closer this value is to 1 the greater weight is put on more recent changes & the closer to 0 returns smoother results.

Start time is another factor that allows choice from which time period smoothing process should start. These settings can be manually adjusted for each test run.

Using the settings for ALPHA = 0.1 and STARTTIME = 1, we get predicted values as depicted In the image for single exponential smoothing , predicted or fitted values are mapped in green line. Note the first predicted or fitted value is starting after period value 1 , chosing a larger value allows to forecast in future. Even by using different values for ALPHA Parameter it’s clear the predicted values from single smoothing were not really fitting the actual values closely, as single exponential smoothing works well for for data that’s pretty much constant over time.

Note Dataset used here is trending data, it is increasing over a period of time and Double Exponent Smoothing algorithm is a better suited for trending data.

It is another time series algorithm which takes into account regular classic smoothing factor ALPHA , and it uses additional BETA, which is trending smoothing factor and takes values from 0 to 1 , again value closer to 1 means more relevance to recent data and another factor for number of periods in future to forecast for in FORECAST_NUM as shown in the image for Double exponent smoothing run we have fitted or predicted values for 5 periods in future and this time fit is much closer to the actual data as shown in the image below.

Next run time: Double Exponent Smoothing Algorithm is used for a different data set. It results in fit as depicted in image Double Exponent Smoothing Run 2 below . Although we achieve a reasonable fit , however looking closely at the data , we can observe input data is not only trending over time it is seasonal as well. There’s a variation or dip every 3 months. When we have seasonality in the data, Triple exponent smoothing is better suited algorithm for this kind of data.

Triple Exponent Smoothing takes into account factors of Single (ALPHA), Double (BETA) for Trending as well as factors for Seasonality , called GAMMA.

It also uses another factor to indicate what is the cycle of seasonality , i.e. quarterly, monthly or yearly . Value in months specified in factor CYCLE.

We see, as shown in the image below, that Triple exponent smoothing results in a much better fit for trending data with seasonality and it can predict values in future as well.

Video links demonstrating aforementioned SAP HANA Cloud Platform Application is shared below. Anyone with S user ID or SCN user id can be easily provided access to HANA Cloud application. Feel free to contact me for any additional details on this subject.

Very useful!!!!

what happens if some of the values in history are null ie not existant?