CrosstabMax
DataWindow expression function
Description
Calculates the maximum value returned by an expression in the values
list of the crosstab. When the crosstab definition has more than one
column, CrosstabMax can also calculate the maximum of the expression’s
values for groups of column values.
For crosstabs only
You can use this function only in a crosstab DataWindow
object.
Syntax
|
1 |
CrosstabMax ( n {, column, groupvalue } ) |
|
Argument |
Description |
|---|---|
|
n |
The number of the crosstab-values expression for |
|
column (optional) |
The number of the crosstab column as it is listed in |
|
groupvalue (optional) |
A string whose value controls the grouping for the |
Return value
Double. Returns the maximum value returned by expression n for all
the column values or, optionally, for a subset of column values. To return
a decimal datatype, use CrosstabMaxDec.
Usage
This function is meaningful only for the maximum of the values of
the expression in a row in the crosstab. This means you can use it only in
the detail band, not in a header, trailer, or summary band.
Null values are ignored and are not included in the
comparison.
For more information about restricting the calculation to groups of
values when the crosstab definition has more than one column, see Usage
for CrosstabAvg.
Reviewing the expressions
To review the expressions defined for the crosstab values, open
the Crosstab Definition dialog box (select Design>Crosstab from the
menubar).
Examples
These examples all use the crosstab-values expressions shown
below:
|
1 |
Count(emp_id for crosstab), Sum(salary for crosstab) |
This expression for a computed field in the crosstab returns the
maximum of the employee counts (the first expression):
|
1 |
CrosstabMax(1) |
This expression for a computed field in the crosstab returns the
maximum of the salary totals (the second expression):
|
1 |
CrosstabMax(2) |
The next two examples use a crosstab with two columns (year and
quarter), a row (product), and a values expression Avg(sales for
crosstab).
This expression for a computed field returns the largest of the
quarterly average sales for each year:
|
1 |
CrosstabMax(1, 2, "@year") |
This expression for a computed field returns the maximum of all the
average sales in the row:
|
1 |
CrosstabMax(1) |
For an example illustrating how the painter automatically defines a
crosstab by creating computed fields using the Crosstab functions, see
CrosstabAvg.
See also