Aggregate function. Returns the average value of a numeric expression evaluated over a set.

Syntax

 Avg( Set_Expression , Numeric_Expression )

Arguments

Set_Expression
MDX expression that returns set.
Numeric_Expression
MDX expression that returns a number.

Returns

Number
Average value of Numeric_expression over set

Example

The following example finds the average Item base amount in the last 52 weeks.

Avg(
  {[Time.Weekly].[Week].CurrentDateMember.Lag(52): 
   [Time.Weekly].[Week].CurrentDateMember.PrevMember},
  CoalesceEmpty(
  ([Measures].[Item base amount],[Time].DefaultMember),
   0)
)