Oracle® OLAP DML Reference 10g Release 1 (10.1) Part Number B10339-02 |
|
|
View PDF |
The MEDIAN function calculates the median of the values of an expression. The median is the middle number in a given sequence of numbers.
Return Value
DECIMAL
Syntax
MEDIAN(expression [dimensions])
Arguments
The expression whose median value is to be calculated.
The dimensions of the result. By default, MEDIAN returns a single value. When you indicate one or more dimensions for the results, MEDIAN calculates a median for each value of the dimensions that are specified and returns an array of values. Each dimension must be a dimension of expression. You cannot use a related dimension as the dimensions argument.
Notes
MEDIAN is affected by the NASKIP option. When NASKIP is set to YES
(the default), MEDIAN ignores NA
values and returns the median of the values that are not NA
. When NASKIP is set to NO
, MEDIAN returns NA
when any value of the expression is NA
. When all the values of the expression are NA
, MEDIAN returns NA
for either setting of NASKIP.
Examples
Example 17-3 Calculating Median Monthly Sales
This example shows how to calculate the median monthly sales of sportswear for each sales district.
LIMIT product TO 'Sportswear' REPORT W 12 HEADING 'Median Sales' MEDIAN(sales district)
The preceding statements produce the following output.
DISTRICT Median Sales ----------------- ------------ Boston 67,923.05 Atlanta 152,186.52 Chicago 94,372.06 Dallas 160,854.60 Denver 86,745.40 Seattle 53,950.28