Cumulative Moving Average - Analytics Database

Database Analytic Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-06
dita:mapPath
gjn1627595495337.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
jmh1512506877710
Product Category
Teradata Vantageā„¢

The cumulative moving average, also known as the running average, is calculated by adding all of the data points up to a certain point in time and dividing by the number of data points. The formula for calculating a cumulative moving average is:

CMA = (Sum of data points up to a specific point in time) / (Number of data points up to that point in time)

For example, the cumulative moving average of a stock's closing price on day 20 would be calculated by adding the closing prices of days 1 through 20 and dividing by 20.

With MAvgType ('C'), the MovingAverage function computes the arithmetic average of all the rows from the beginning of the series with this formula:

CMA = (V1 + V2 + ... + VN)/N

Vi is a value. N is the number of rows from the beginning of the data set.