Calculates the percent difference between the values of two measures.
Multiplying this fraction by 100 generates the percentage.
The template presents two measure 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
Percent difference between measures measure name and measure name
Example: Example of Percent Difference Between Two Measures
The sales_pct_2011 calculates the ratio of the difference between SALES values and the SALES values for 2011.
Calculation in Template
Percent difference between measures SALES and sales_2011.
Definition of Calculated Measure in Analytic View
The MEASURES clause of the SALES_AV analytic view definition includes this definition of the sales_pct_2011 calculated measure:
sales_pct_2011 AS (SALES - sales_2011) / SALES
The sales_2011 calculated measure is defined as:
sales_2011 AS QUALIFY (SALES, TIME_HIER = YEAR ['11'])
SELECT Statement Using the Calculated Measure
SELECT TIME_ATTR_DIM.TIME_HIER.member_caption AS "TIME_ATTR_DIM",
PRODUCT_ATTR_DIM.PRODUCT_HIER.member_caption AS "PRODUCT_ATTR_DIM",
SALES AS "SALES" ,
sales_pct_2011 AS "Percent Sales 2011"
FROM SALES_AV HIERARCHIES(TIME_ATTR_DIM.TIME_HIER, PRODUCT_ATTR_DIM.PRODUCT_HIER)
WHERE (TIME_ATTR_DIM.TIME_HIER.level_name IN ('ALL','YEAR')) AND
(PRODUCT_ATTR_DIM.PRODUCT_HIER.level_name IN ('ALL','DEPARTMENT'))
ORDER BY
TIME_ATTR_DIM.TIME_HIER.hier_order,
PRODUCT_ATTR_DIM.PRODUCT_HIER.hier_order
Results of the Query
TIME_ATTR_DIM PRODUCT_ATTR_DIM SALES Percent Sales 2011 ------------- ---------------------- ----------- ------------------ (null) (null) 36418586335 .8145146020 (null) Cameras and Camcorders 2381468141 .8144002526 (null) Computers 33412202644 .8145213443 (null) Portable Music and Video 624915550 .8145898833 CY2011 (null) 6755115981 0 CY2011 Cameras and Camcorders 441999885 0 CY2011 Computers 6197250430 0 CY2011 Portable Music and Video 115865665 0 CY2012 (null) 6901682399 .0212363319 CY2012 Cameras and Camcorders 451487776 .0210147224 CY2012 Computers 6331603801 .0212194848 CY2012 Portable Music and Video 118590822 .0229794970 CY2013 (null) 7240938718 .0670938888 CY2013 Cameras and Camcorders 472866560 .0652756544 CY2013 Computers 6643616382 .0671871953 CY2013 Portable Music and Video 124455776 .0690213941 CY2014 (null) 7579746353 .1087939271 CY2014 Cameras and Camcorders 496952313 .1105788747 CY2014 Computers 6952712286 .1086571434 CY2014 Portable Music and Video 130081754 .1092858036 CY2015 (null) 7941102885 .1493478829 CY2015 Cameras and Camcorders 518161608 .1469844951 CY2015 Computers 7287019745 .1495493841 CY2015 Portable Music and Video 135921532 .1475547445