Go to primary content

Average of Three Measures

Returns the average of three measures.

The template presents three measures of the analytic view. To select a different measure, click the underlined value in the template and make a selection from the Select Measures dialog box.

Template

Average of three measures: measure name, measure name, and measure name

Example: Example of Average of Three Measures

The avg_3_measures calculated measure returns the average of the UNITS values for 2011, the UNITS values for 2012, and the UNITS values for 2013.

Calculation in Template

Average of three measures: units_2011, units_2012, and units_2013.

Definition of Calculated Measure in Analytic View

The MEASURES clause of the SALES_AV analytic view definition includes these calculated measure definitions:

avg_3_measures AS (units_2011 + units_2012 + units_2013) / 3
units_2011 AS QUALIFY (UNITS, TIME_HIER = YEAR ['11'])
units_2012 AS QUALIFY (UNITS, TIME_HIER = YEAR ['12'])
units_2013 AS QUALIFY (UNITS, TIME_HIER = YEAR ['13'])

SELECT Statement Using the Calculated Measure

SELECT PRODUCT_ATTR_DIM.PRODUCT_HIER.member_caption AS "PRODUCT",
       UNITS_2011 AS "UNITS 2011",
       UNITS_2012 AS "UNITS 2012",
       UNITS_2013 AS "UNITS 2013",
       round(AVG_3_MEASURES,2) AS "AVG 3 MEASURES"
FROM SALES_AV HIERARCHIES(TIME_ATTR_DIM.TIME_HIER, PRODUCT_ATTR_DIM.PRODUCT_HIER)
WHERE (TIME_ATTR_DIM.TIME_HIER.member_name = 'CY2013') AND
      (PRODUCT_ATTR_DIM.PRODUCT_HIER.level_name IN ('DEPARTMENT'))
ORDER BY
      PRODUCT_ATTR_DIM.PRODUCT_HIER.hier_order;

Results of the Query

PRODUCT                 UNITS 2011  UNITS 2012  UNITS 2013  AVG 3 MEASURES
----------------------  ----------  ----------  ----------  --------------
Cameras and Camcorders     1738669     1735126     1732285         1735360
Computers                 19590722    19539484    19546909      19559038.3
Portable Music and Video   3133053     3126009     3128065      3129042.33