CUMAVG
Syntax
CUMAVG (Dimension, Data, {Count})
Description
The CUMAVG function returns the cumulative average of Data for the last Count members of Dimension. If Count is omitted, CUMAVG returns the cumulative average of all members up to the member being calculated.
Example
The following examples provide uses of the CUMAVG function:
Example 1
Suppose an analytic model contains a data cube called SCORES that uses a dimension called TESTS. Use the following formula to compute the average of all test scores up to the test being calculated:
CUMAVG(TESTS, SCORES)
This formula calculates Cum_Avg_Score for Test 2 by averaging the scores for Test 1 and Test 2; it calculates Cum_Avg_Score for Test 3 by averaging the scores for Test 1, 2, and 3; and so on. Because the third argument is omitted, the function averages the scores for all tests up to the test being calculated.
Example 2
Suppose an analytic model contains a data cube called SALES that uses a dimension called MONTHS. Compute the average sales for the last six months as follows:
CUMAVG(MONTHS, SALES, 6)
Note that for the first five months, the CUMAVG function cannot look back six months, because this would go back before the first month in the MONTHS dimension. The program solves this problem by averaging the sales for all months up to the month being calculated. After the first five months, the function averages the sales for the six months up to the month being calculated.