Reference Guide > TDV Support for SQL Functions > Analytical Functions > EXPONENTIAL_MOVING_AVERAGE
 
EXPONENTIAL_MOVING_AVERAGE
Calculates the exponential moving average (EMA) of expression E with smoothing factor X. An EMA differs from a simple moving average in that it provides a more stable picture of changes to data over time.
The EMA is calculated by adding the previous EMA value to the current data point scaled by the smoothing factor, as in the following formula:
 
EMA = EMA0 + (X * (E - EMA0))
where:
E is the current data point
EMA0 is the previous row's EMA value.
X is the smoothing factor.
Syntax
EXPONENTIAL_MOVING_AVERAGE ( E, X ) OVER (
... [ window-partition-clause ]
... window-order-clause )
where
E - The value whose average is calculated over a set of rows. Can be INTEGER, FLOAT or NUMERIC type and must be a constant.
X - The value whose average is calculated over a set of rows. Can be INTEGER, FLOAT or NUMERIC type and must be a constant.