Simple Moving Average Calculation

Overview: In this tutorial you will learn the use of Moving Average Calculation in SAC and their syntax with examples.

SMA() Function

Moving Average calculation in SAC is the indicator which can be calculated by the sum of the all values or data points during a specific time periods, divided by the sum of the number of time periods

In mathematical way you can see below definition

SMA = ( Z1 + Z2 + Z3 + ………. Zn) / n
Where:

  • Z represent the average in period “n” time
  • “n” represent the number of periods

Syntax in SAC:

SMA ([account member],[d/ “date dimension”], “time granularity”, period)

Note:

SMA() function are available only in Modeler of SAP analytics cloud.

Lets understand with few examples

Example #1: Moving Average Calculation for Year

Lets take example for TotalRevenuew measure, where we will calculate the Simple Moving Average of TotalRevenue using the last two years with Date columns

SMA ( [TotalRevenue], [d/Date], “Year”, 2 )

In above example, Moving Average is calculating for Total Revenue with date column and its taking year from date column for 2 year of data.

You can calculate this function and use in your Stories table and chart view like bar chart, combined chart

Example #2: Moving Average for Month

Lets take example for TotalRevenue measure, However here we will calculate the Simple Moving Average of TotalRevenue using the last three months of data with Date columns

SMA ( [TotalRevenue], [d/Date], “Month”, 2 )

In above example, Moving Average will calculate for Total Revenue with date column and its taking Month from Date column for 3 months data.

Conclusion:

From above Simple Moving Average Calculation you have understand the below points

  • A moving average in SAC is a indicator use to determine the trend
  • It is calculated by sum all the data points during a specific period and dividing the sum of time periods.
  • Understand of syntax of SMA() function
  • It can be use for both year and month calculation

Scroll to Top