Oracle® OLAP DML Reference 10g Release 2 (10.2) B1434603 


PDF · Mobi · ePub 
The STDDEV function calculates the standard deviation of the values of an expression.
When STDDEV is affected by the NASKIP option. When NASKIP is set to YES
(the default), STDDEV ignores NA
values and returns the standard deviation of the values that are not NA
. When NASKIP is set to NO
, STDDEV returns NA
when any value in the calculation is NA
. When all data values for a calculation are NA
, STDDEV returns NA
for either setting of NASKIP.
DECIMAL
STDDEV(expression [dimensions])
The numeric expression whose standard deviation is to be calculated.
The dimensions of the result. By default, STDDEV returns a single value. When you indicate one or more dimensions for the results, STDDEV calculates a standard deviation along the specified dimension(s) and returns an array of values. Each dimension must be either a dimension of expression or related to one of its dimensions. When it is a related dimension, you can specify the name of the relation instead of the dimension name. This enables you to choose the relation to use when there is more than one.
Using STDDEV With an Expression Dimensioned by a DWMQY Dimension
When expression is dimensioned by a dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR, you can specify any other dimensions of type DAY, WEEK, MONTH, QUARTER, or YEAR as a related dimension. Oracle OLAP uses the implicit relation between the dimensions. To control the mapping of one dimensions of type DAY, WEEK, MONTH, QUARTER, or YEAR to another (for example, from weeks to months), you can define an explicit relation between the two dimensions and specify the name of the relation as the dimension argument to the STDDEV function.
For each time period in the related dimensions of type DAY, WEEK, MONTH, QUARTER, and YEAR, Oracle OLAP calculates the standard deviation of the data values of the source time periods that end in the target time period. This method is used regardless of which dimension has the more aggregate time periods. To control the way in which data is aggregated or allocated between the periods of two dimensions of type DAY, WEEK, MONTH, QUARTER, and YEAR, you can use the TCONVERT function.
Example 251 Calculating the Standard Deviation of Monthly Sales
This example calculates the average number of tents sold during the first three months of 1996, along with the standard deviation from that average.
LIMIT district TO ALL LIMIT month TO 'Jan96' TO 'Mar96' LIMIT product TO 'Tents' REPORT HEADING 'Average' AVERAGE(units month)  HEADING 'Stddev'STDDEV(units months)
These statements produce the following output.
MONTH Average Stddev    Jan96 262.33 49.32 Feb96 247.83 57.37 Mar96 320.50 68.17