diff --git a/data-explorer/kusto/query/max-of-function.md b/data-explorer/kusto/query/max-of-function.md index b20a104ee2..2e247c5427 100644 --- a/data-explorer/kusto/query/max-of-function.md +++ b/data-explorer/kusto/query/max-of-function.md @@ -3,7 +3,7 @@ title: max_of() description: Learn how to use the max_of() function to return the maximum value of all argument expressions. ms.reviewer: alexans ms.topic: reference -ms.date: 08/11/2024 +ms.date: 12/15/2024 --- # max_of() @@ -35,6 +35,8 @@ The maximum value of all argument expressions. ### Find the largest number +This query returns the maximum value of the numbers in the string. + :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] > Run the query @@ -52,7 +54,7 @@ print result = max_of(10, 1, -3, 17) ### Find the maximum value in a data-table -Notice that non-null values take precedence over null values. +This query returns the highest value from columns A and B. Notice that non-null values take precedence over null values. :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] @@ -80,3 +82,30 @@ datatable (A: int, B: int) |2| |1| |(null)| + +### Find the maximum datetime + +This query returns the later of the two datetime values from columns A and B. + +:::moniker range="azure-data-explorer" +> [!div class="nextstepaction"] +> Run the query +::: moniker-end + +```kusto +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 |