Skip to main content

Avg (MDX)

Returns the Average of a Measure evaluated over a specified set.

Syntax

Avg( Set_Expression, Measure )

Input Parameters

Set_Expression
A valid Multidimensional Expressions (MDX) expression that returns a set.

Measure
A basic Measure.

Return Value

Returns a value of the same type as Measure equaling the Average of the Measure evaluated over the given set.

Examples

Returns the Average of salesamount1 over a 30 period window on the [Order Date Dimension].[Order Retail445] hierarchy.

Avg(
[Order Date Dimension].[Order Retail445].CurrentMember.Lag(29)
:
[Order Date Dimension].[Order Retail445].CurrentMember,
[Measures].[salesamount1]
)

Returns the Average salesamount1 value for [DateCustom].[StandardMonth] Years 2007 through 2008.

Avg(
{[DateCustom].[StandardMonth].[Year].&[2007-01-01T00:00:00]:[DateCustom].[StandardMonth].[Year].&[2008-01-01T00:00:00]},
[Measures].[salesamount1]
)