AVG

AVG returns the average of a selection of values calculated over a Time dimension.

Return Value

NUMBER

Syntax

AVG (value_expr) OVER HIERARCHY 
    ( [ dimension | hierarchy ]
	   BETWEEN start AND end [WITHIN relation]
    )

Arguments

value_expr is a dimensional expression whose values you want to calculate.

dimension is the Time dimension over which the values are calculated.

hierarchy is theTime hierarchy over which the values are calculated. Otherwise, the default Time hierarchy is used.

start and end are the boundaries of the calculation, which are expressed with one of these clauses:

relation can be any of the following. The GREGORIAN relations superimpose the Gregorian calendar on the Time dimension. These relations can be useful for calculations on fiscal and non-standard hierarchies.

Example

The following example calculates a running average for quarters within each calendar year.

AVG(GLOBAL.UNITS_CUBE.UNITS) OVER HIERARCHY (GLOBAL.TIME.CALENDAR BETWEEN UNBOUNDED PRECEDING AND CURRENT MEMBER WITHIN PARENT)

AVG Function Example
TIME
PARENT
UNITS
UNITS_AVG
Q1.05 CY2005
143607
143607
Q2.05 CY2005
138096
140852
Q3.05 CY2005
138953
140219
Q4.05 CY2005
145062
141430
Q1.06 CY2006
146819
146819
Q2.06 CY2006
145233
146026
Q3.06 CY2006
143572
145208
Q4.06 CY2006
149305
146232

Related Topics

COUNT, MAX, MIN, SUM