###### Technical Articles # SAP Analytics Cloud In-story Calculation Series – Blog2: Simulate quantity sold under different discounts

This is the second blog of SAP Analytics Cloud In-story Calculation Series. Check out our blog series here to learn more functionalities about In-story Calculation in SAP Analytics Cloud.

Scenario:

Your marketing department summarized a pattern between discount and the increase in quantity sold of different product lines. They would like to dynamically observe the effects of applying different discounts on the quantity sold by location. The pattern is summarized as below:

 Product Line Discount and The Increase Of Quantity Sold Alcohol 1-10% discount: 100M per 1% discount 11-20% discount: 200M per 1% discount Juices 1-10% discount: 80M per 1% discount Carbonated Drinks 1-10% discount: 100M per 1% discount

In-story Calculations:

• Calculated Measure with Input Control

Create Calculated Measure with Input Control

Calculated Input Control is a functionality that can be created within a calculation and used in formulas. In our scenario, it allows the end-users to choose the discount percentage of different product lines and show how it affects the total quantity sold in different locations. You need to create 3 Calculated Measures because the discount and quantity increase patterns are unique for each product line.

The first Calculated Measure is for Alcohol:

• Step 1: Create an Input Control for the discount of Alcohol   • Step 2: Use IF Statement to calculate the increase of Quantity Sold of Alcohol The second Calculated Measure is for Carbonated Drinks:

• Step 1: Create an Input Control for the discount of Carbonated Drinks • Step 2: Use Multiplication to calculate the increase of Quantity Sold of Carbonated Drinks Similar to Carbonated Drinks, the Calculated Measure for Juices is: Once Input Controls are created, we can go back to the canvas and resize it as desired. The above calculations can be validated by using slider-style Input Controls to apply the discount on different product lines.

Create Calculated Measures to show the simulated results

To show the simulated results of quantity sold under different discounts, we need to create a calculation as below:

• Quantity Sold Simulation = Quantity Sold + Quantity Sold Increase of Alcohol + Quantity Sold Increase of Carbonated Drinks + Quantity Sold Increase of Juices Build your What-if scenario

Now you can use all Calculated Measures you created to build your What-if scenario in SAP Analytics Cloud.

If you enjoyed this blog post, share it with a friend! The next blog will discuss how to use In-story Calculation to count Pass/Fail results and calculate the pass rate accordingly. Don’t hesitate to follow this blog series if it’s useful for you!

* The product interface may vary depending on the product version