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

Part Number B14346-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

MAX

The MAX function calculates the larger value of two expressions.

Return Value

DECIMAL

Syntax

MAX(expression1expression2)

Arguments

expression1

One expression to be compared.

expression2

The other expression to be compared.

Notes

Dimensions of the Result Returned by MAX

Ordinarily, the dimensions of both the expressions you want to compare and the results of MAX are the same. When the dimensions of one expression are a subset of the other's dimensions, then the results of MAX are dimensioned by the larger set of dimensions. In any case, the results of MAX are dimensioned by the union of the dimensions of the two expressions.

Examples

Example 18-57 Calculating Whether Actual or Budget Values Are Larger

Suppose, for each of the first six months of 1996, you want to find whether the actual value or the budget value is larger for the line item Cost of Goods Sold (Cogs) in the Sporting division.

LIMIT line TO 'Cogs'
LIMIT division TO 'Sporting'
LIMIT month TO 'Jan96' TO 'Jun96'
REPORT DOWN month actual budget MAX(actual budget)

The preceding statements produce the following output.

DIVISION: SPORTING
               --------------LINE--------------
               --------------COGS--------------
                                        MAX    
                                      (ACTUAL  
MONTH            ACTUAL     BUDGET    BUDGET)  
-------------- ---------- ---------- ----------
Jan96          287,557.87 279,773.01 287,557.87
Feb96          315,298.82 323,981.56 323,981.56
Mar96          326,184.87 302,177.88 326,184.87
Apr96          394,544.27 386,100.82 394,544.27
May96          449,862.25 433,997.89 449,862.25
Jun96          457,347.55 448,042.45 457,347.55