The aim of this blog is demonstrate the creation of a ‘What-if’ analysis report with SAP design studio and HANA as backend database. Let’s consider a scenario ,where we have to decide between ‘Buy Now’ and ‘Buy Later’ options, based on the below user inputs.
- Unit Price
- Delay Days
On click of the ‘Submit’ button, the values entered in the input fields (Unit Price,Quantity,Discount & delay days) will be passed on to the ‘Input parameters’ of the HANA data model.
Below script is written on the ‘On-Click’ event of the submit button to pass on the values to the Input parameters of the HANA model.
Here ‘DS_WHATIF_ANALYSIS’ is the data source that is built in design studio on top of the HANA data model. Based on the input values(a,b,c,d), the HANA model will determine the ‘Buy Now’ & ‘Buy Later’ values in a chart in design studio output.
HANA Data Model:
The HANA model is based on a table (has 2 columns containing the inflation rate for each month).
Create 4 input parameters (Day_Delay, Unit_Price, Quantity & Discount) of parameter type ‘Direct’. These are the input parameters that will receive the input values entered by the user in the report.
Create another input parameter ‘Inflation_Curr’ of parameter type ‘Derived from table’. This is the current inflation rate, which will be maintained in a custom table.
Create the below calculated columns in the same sequence as below,
Here we are adding the delay days from the input to the current date to get the Buy later period.
Buy now will consider ‘discount percentage’ and ‘Holding Cost’ into consideration.
Buy later will consider the inflation rate for the delayed period into consideration.
Now let’s activate the model and test the it.
Enter the values for the input parameters.
We can see the value of ‘Buy Now’ and ‘Buy Later’ prices now. The same will be represented in design studio as a chart, when we click on the submit button.
Design Studio report Output:
Based on the above output, ‘Buy Now’ seems like a better option.