Skip to main content

PQL47 (PQL Function Library - CPM 4.7)

MAX

Applies to: CELONIS 4.0 CELONIS 4.2 CELONIS 4.3 CELONIS 4.4 CELONIS 4.5 CELONIS 4.6 CELONIS 4.7

Description

This function calculates the maximum value per group. MAX can be applied on any data type.

Syntax
MAX ( table.column )
NULL handling

NULL values are ignored, meaning that they do not influence the result. If all values of a group are NULL, the result for this group is also NULL.

Examples

[1] Maximum of column.

Query

Column1

MAX ( "Table"."Column" )

Input

Output

Table

Column : INT

1

-3

4

Result

Column1 : INT

4

[2] Get the maximum value by country.

Query

Column1

"Table"."Country"

Column2

MAX ( "Table"."Values" )

Input

Output

Table

Country : STRING

Values : INT

'US'

3

'DE'

10

'DE'

5

'FR'

5

'US'

4

'US'

3

Result

Column1 : STRING

Column2 : INT

'DE'

10

'FR'

5

'US'

4

[3] Get the maximum value mixed with nulls, grouped by country.

Query

Column1

"Table"."Country"

Column2

MAX ( "Table"."Values" )

Input

Output

Table

Country : STRING

Values : INT

'FR'

10

'FR'

null

'DE'

null

Result

Column1 : STRING

Column2 : INT

'DE'

null

'FR'

10

See also: