16.20 - Cumulative Moving Average - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ - NewSQL Engine Analytic Functions

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Release Date
July 2019
Content Type
Programming Reference
Publication ID
B035-1206-162K
Language
English (United States)

In a cumulative moving average (CMA), the data are added to the data set in an ordered data stream over time. The objective is to compute the average of all the data at each point in time when new data arrived. A typical use case is an investor who wants to find the average price of all transactions of a specific stock over time, up to the current time.

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

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