Returns the average of two measures.
The template presents two 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 two measures: measure name and measure name
Example: Example of Average of Two Measures
The sales_avg_2011_2012 calculates the average of the SALES values for 2011 and the SALES values for 2012.
Calculation in Template
Average of two measures: sales_2011 and sales_2012.
Definition of Calculated Measure in Analytic View
The MEASURES clause of the SALES_AV analytic view definition includes these calculated measure definitions:
sales_2011 AS QUALIFY (SALES, TIME_HIER = YEAR ['11']) sales_2012 AS QUALIFY (SALES, TIME_HIER = YEAR ['12']) sales_avg_2011_2012 AS (sales_2011 + sales_2012) / 2
SELECT Statement Using the Calculated Measure
SELECT PRODUCT_ATTR_DIM.PRODUCT_HIER.member_caption AS "PRODUCT",
round(SALES_2011,2) AS "Sales 2011",
round(SALES_2012,2) AS "Sales 2012",
round("sales_avg_2011_2012",2) AS "Average Sales"
FROM SALES_AV HIERARCHIES(TIME_ATTR_DIM.TIME_HIER, PRODUCT_ATTR_DIM.PRODUCT_HIER)
WHERE (TIME_ATTR_DIM.TIME_HIER.member_name = 'CY2012') AND
(PRODUCT_ATTR_DIM.PRODUCT_HIER.level_name IN ('DEPARTMENT'))
ORDER BY PRODUCT_ATTR_DIM.PRODUCT_HIER.hier_order;
Results of the Query
PRODUCT Sales 2011 Sales 2012 Average Sales ---------------------- ---------- ---------- ------------- Cameras and Camcorders 441999885 451487776 446743831 Computers 6197250430 6331603801 6264427116 Portable Music and Video 115865665 118590822 117228244
Parent topic: Averages