###### Technical Articles

# Calculated Fields in SAC Story

**Introduction **

Create calculated measures and dimensions in stories of Sap analytics cloud. One of the major advantages of creating these formulas in stories instead of model is that we can use it onetime for the particular story or if we forget to add any calculated fields in model as well.

**Methods using an Example**

For example creating a bar/column chart with a calculated field.

Select create calculation from measures

There in Calculation editor you can see different types of calculation methods which are

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

And on the right hand side you can see different types of available objects like input controls and formula functions like functions ,operators and conditions.

***Calculated Measures**

Calculated Measures are used to apply any kind of mathematical formulas to our data. Here we are using different kinds of functions, operators and conditions.For Example we need to find out the Total duty Percentage.So Total duty value divided by Total accessable value formula used.

***Restricted Measures**

Here we restricted measure No of shipments for 0 to 2 Days.

***Difference From**

***Aggregation**

The Aggregation calculation creates a measure with an aggregated values such as sum, count or another aggregation types. To produce an aggregate value, SAP Analytics Cloud create mathematical functions on a measure that return a single value. Different types of aggregation methods are given below.

Sum : Sum of the selected dimensions.

Count : Count of the selected dimension.

Count dimension : Count of dimension without measures are available.

Average : Average value of Measure values across particular dimensions.

Min : smallest value of selected dimensions.

Max : Largest value of selected dimensions.

These are the mainly used aggregation operations.

***Date Difference**

It is used to findout the particular difference between two date fields.If the date field are null this function does not detect the particular datefield.

***Dimension to Measure**

Dimension to Measure based calculations allow you to convert a string to a numeric value.

**Calculated Dimension**

From the Dimension of designer select create calculated Measure.

Mainly there are two types of calculed Dimesion methods Which are

***Calculated Dimension**

Calculated Dimesions are used to do the calculations of dimensions using mathematical formulas.

***Measure based Dimension**

Measure based Dimensions are used to group particular values based on measures .

Here we grouped clearance time based on 0 to 2 days and Above 2 Days.

**Conclusion**

This Blog is based on my short term experience in SAP Analytics Cloud. Creating calculated fields in story has been shown here in this blog. Please correct me if there is any mistake.

**References:**

https://www.sapanalytics.cloud/resources-applying-aggregation/

https://www.sapanalytics.cloud/resources-in-story-calculations/

thanks for sharing, have you created calculated dimension at model level?

Hi Dinesh Anblazahan ,

yes i have created.The same way we can create in model level too.

Thanks,

Sreelakshmi

Hi Dinesh,

yes, you create calculated column a model itself. Also you can calculate the ageing buckets at model level.

I have created two scenario where I am calculating buckets in model level and same thing replicated at story level as well.

Thanks

Nimish Garg

hi,

I have no of weeks(counter) as measure in hana calculation view.in SAC i want to display the no of week count on top of fiscal year hierarchy mainatined in sac like(Y,Q,M).how to achieve that?