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
Given a dynamic field
This parameter is string-only. In permissive mode — the default — almost every field arrives as a dynamic, so passing one works because Berserk injects asstring: extract-or-null, the value when it really is a string and null otherwise, so the call yields null (a predicate yields false). A property bag or array is therefore not matched, and tostring() is never applied implicitly — use it explicitly to match a bag's JSON text, keys included. Strict mode rejects the dynamic instead of coercing it. See String coercion and the asXXX family.
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) |
|---|---|
| Fairhair | 25 |
| Lothbrok | 42 |
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) |
|---|---|---|---|
| Fairhair | 25 | Harald | 2023-09-10T00:00:00Z |
| Lothbrok | 42 | Ragnar | 2024-06-01T00:00:00Z |