# MAX

The MAX function calculates the larger value of two expressions.

Return Value

DECIMAL. The results of MAX are dimensioned by the union of the dimensions of the two expressions

Syntax

MAX(expression1expression2)

Arguments

expression1

One expression to be compared.

expression2

The other expression to be compared.

Examples

Example 8-21 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
```