SAP

#### Author Maddy is a content creator for SAP Analytics Cloud. She has a passion for everything digital and enjoys finding creative ways to simplify complex concepts. When she’s not behind her computer you’ll find her enjoying live music, watching a play, or paddling with her dragon boat team.

#### Keep in touch

Subscribe for the latest news, updates, tips and more delivered right to your inbox.

Learning

#### Connect with us

Calculations are an important part of analyzing your business data. The right calculation can go a long way to helping you track progress, solve problems, and make decisions.

In SAP Analytics Cloud, calculations use formulas to create new measures based on your business data. You can add calculations in the modeling stage by adding formulas to your model, or you can create in-story calculations. In-story calculations create story-specific measures that can be added to any chart within your story.

When setting up in-story calculations you can choose from the following types:

• Calculated Measure
• Restricted Measure
• Difference From
• Aggregation
• Date Difference
• Dimension to Measure

## The Calculation Editor

To get started with in-story calculations, you’ll want to access the Calculation Editor. This is where you will set up the formulas to create calculations to use within your story.

To open the Calculation Editor select a chart and open the Design Panel. Then, select the ‘New Calculation’ option from the ‘Measures’ drop-down menu. ### Calculated Measures

The Calculated Measures calculation creates a new measure by applying mathematical formulas to your data.

When setting up your calculation, you’ll apply the typical formula functions, conditions, and operators to the data contained in your model. Use calculation shortcuts to access your existing model data.

Type the following characters to access model data to add to your formula:

• [  to access measures
• # to access calculations
• @ to access input controls

For example, to create a calculated measure of gross margin percentage, your formula should divide the measure “gross margin” by the measure “discount”. ### Restricted Measures

The Restricted Measure calculation creates a new measure by restricting the measure’s value to a selected dimension(s).

For example, you may want to calculate the value of revenue restricted by a single product. By creating a restricted measure, you can compare the revenue performance of a single product type to the whole product dimension in a chart.

There are two ways to determine the value of the restricted measure:

1. Select a specific dimension. For example, if your selected dimension is “product” you can restrict the measure by the entire product dimension, or you can choose specific member(s) of that dimension.
2. Set up an input control. Input controls allow you to dynamically restrict the measure’s value by different dimensions. In the example below, the value of the restricted measure changes based on the input control selection. ### Difference From

The Difference From calculation creates a measure reflecting the calculated difference in value between two time periods. Similarly to time-based variances, there are some standard time periods that can be used for your Difference From calculation.

• Period over Period (PoP): Compares a selected time period to the equivalent time period directly prior. For example, selecting a 60-day period will compare to the 60-day period directly prior.
• Year over Year  (YoY): Compares to the equivalent period in the year prior. For example, Q1 2017 would compare to Q1 2016.
• Quarter over Quarter (QoQ): Compares to the equivalent period in the previous quarter. For example, Month 1 in Q2 would compare to Month 1 in Q1.
• Month over Month (MoM): Compares to the equivalent period in the previous month. For example, Day 1 in Month 2 would compare to Day 1 in Month 1.

When you create a Difference From calculation, the resulting measure’s value reflects both the calculation and chart properties. ### Aggregation

The Aggregation calculation creates a measure with an aggregate value such as sum, average, or another aggregation type. To produce aggregate values, SAP Analytics Cloud performs mathematical functions on a measure to return a single value.

The Calculation Editor supports the following aggregation functions:

 Function Result Sum Sum of the measure’s values across all members of the selected dimensions. Count Number of values of the selected dimensions. Empty values are not counted. Count Dimensions Number of members of the selected dimensions, regardless of whether their values are empty or not. Average Average of the measure’s values across the selected dimensions. Min Smallest value across the selected dimensions. Max Largest value across the selected dimensions.

Watch the video below for a step-by-step example of how to set up an in-story aggregation calculation.