max_of()
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Returns the maximum value of all argument expressions.
Syntax
max_of(
arg,
arg_2,
[ arg_3,
... ])
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
arg_i | scalar | ✔️ | The values to compare. |
- All arguments must be of the same type.
- Maximum of 64 arguments is supported.
- Non-null values take precedence to null values.
Returns
The maximum value of all argument expressions.
Examples
Find the largest number
This query returns the maximum value of the numbers in the string.
print result = max_of(10, 1, -3, 17)
Output
result |
---|
17 |
Find the maximum value in a data-table
This query returns the highest value from columns A and B. Notice that non-null values take precedence over null values.
datatable (A: int, B: int)
[
1, 6,
8, 1,
int(null), 2,
1, int(null),
int(null), int(null)
]
| project max_of(A, B)
Output
result |
---|
6 |
8 |
2 |
1 |
(null) |
Find the maximum datetime
This query returns the later of the two datetime values from columns A and B.
datatable (A: datetime, B: datetime)
[
datetime(2024-12-15 07:15:22), datetime(2024-12-15 07:15:24),
datetime(2024-12-15 08:00:00), datetime(2024-12-15 09:30:00),
datetime(2024-12-15 10:45:00), datetime(2024-12-14 10:45:00)
]
| project maxDate = max_of(A, B)
Output
maxDate |
---|
2024-12-15 07:15:24 |
2024-12-15 09:30:00 |
2024-12-15 10:45:00 |