Berserk Docs
Aggregate FunctionsStatistical

max

Returns the maximum value across the group.

Syntax

max(val)

Parameters

Prop

Type

Returns: bool

Syntax

max(val)

Parameters

Prop

Type

Returns: int

Syntax

max(val)

Parameters

Prop

Type

Returns: long

Syntax

max(val)

Parameters

Prop

Type

Returns: real

Syntax

max(val)

Parameters

Prop

Type

Returns: string

Syntax

max(val)

Parameters

Prop

Type

Returns: datetime

Syntax

max(val)

Parameters

Prop

Type

Returns: timespan

Syntax

max(val)

Parameters

Prop

Type

Returns: guid

Syntax

max(val)

Parameters

Prop

Type

Returns: dynamic

Examples

Example 1 — Maximum numeric value per group

datatable(clan:string, warrior:string, voyages:long)[
  "Lothbrok", "Ragnar", 42,
  "Lothbrok", "Bjorn", 31,
  "Fairhair", "Harald", 25,
  "Fairhair", "Halfdan", 12
]
| summarize max(voyages) by clan
clan (string)max_voyages (long)
Fairhair25
Lothbrok42

Example 2 — Maximum across numeric, string, and datetime columns

datatable(clan:string, warrior:string, voyages:long, joined:datetime)[
  "Lothbrok", "Ragnar", 42, datetime(2024-01-15),
  "Lothbrok", "Bjorn", 31, datetime(2024-06-01),
  "Fairhair", "Harald", 25, datetime(2023-03-20),
  "Fairhair", "Halfdan", 12, datetime(2023-09-10)
]
| summarize max(voyages), max(warrior), max(joined) by clan
clan (string)max_voyages (long)max_warrior (string)max_joined (datetime)
Fairhair25Harald2023-09-10T00:00:00Z
Lothbrok42Ragnar2024-06-01T00:00:00Z

On this page