From 55773240e15152a28d2f3209c34f8714b210e9ca Mon Sep 17 00:00:00 2001 From: andykop <165172502+AndyKop@users.noreply.github.com> Date: Sun, 15 Dec 2024 10:56:57 +0200 Subject: [PATCH 1/4] add datetime example --- data-explorer/kusto/query/max-of-function.md | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/data-explorer/kusto/query/max-of-function.md b/data-explorer/kusto/query/max-of-function.md index b20a104ee2..634a99857b 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() @@ -80,3 +80,25 @@ datatable (A: int, B: int) |2| |1| |(null)| + +### Find the maximum datetime + +:::moniker range="azure-data-explorer" +> [!div class="nextstepaction"] +> Run the query +::: moniker-end + +```kusto +let date1 = datetime(2024-12-15 07:15:22); +let date2 = datetime(2024-12-15 07:15:24); +let date3 = datetime(2024-12-15 08:00:00); +let date4 = datetime(2024-12-15 09:30:00); +let date5 = datetime(2024-12-15 10:45:00); +| print maxDate = max_of(date1, date2, date3, date4, date5); +``` + +**Output** + +| maxDate | +| --- | +| 2024-12-15 10:45:00 | From a252cb643bb00fcdda4f32e4d520ff8f59520f49 Mon Sep 17 00:00:00 2001 From: Shlomo Sagir <51323195+shsagir@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:17:30 +0200 Subject: [PATCH 2/4] Update data-explorer/kusto/query/max-of-function.md --- data-explorer/kusto/query/max-of-function.md | 22 +++++++------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/data-explorer/kusto/query/max-of-function.md b/data-explorer/kusto/query/max-of-function.md index 634a99857b..4b3880bbf3 100644 --- a/data-explorer/kusto/query/max-of-function.md +++ b/data-explorer/kusto/query/max-of-function.md @@ -85,20 +85,14 @@ datatable (A: int, B: int) :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] -> Run the query +> Run the query ::: moniker-end ```kusto -let date1 = datetime(2024-12-15 07:15:22); -let date2 = datetime(2024-12-15 07:15:24); -let date3 = datetime(2024-12-15 08:00:00); -let date4 = datetime(2024-12-15 09:30:00); -let date5 = datetime(2024-12-15 10:45:00); -| print maxDate = max_of(date1, date2, date3, date4, date5); -``` - -**Output** - -| maxDate | -| --- | -| 2024-12-15 10:45:00 | +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) From 7421f9f5e209dc2f93cbce094ddefd9ec36cc936 Mon Sep 17 00:00:00 2001 From: andykop <165172502+AndyKop@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:37:29 +0200 Subject: [PATCH 3/4] added intro sentences --- data-explorer/kusto/query/max-of-function.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/data-explorer/kusto/query/max-of-function.md b/data-explorer/kusto/query/max-of-function.md index 4b3880bbf3..54c14024db 100644 --- a/data-explorer/kusto/query/max-of-function.md +++ b/data-explorer/kusto/query/max-of-function.md @@ -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"] @@ -83,6 +85,8 @@ datatable (A: int, B: int) ### 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 @@ -96,3 +100,11 @@ datatable (A: datetime, B: datetime) 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 | From 2c2873372fae08ae6333e3ec2c33e74a1704acca Mon Sep 17 00:00:00 2001 From: andykop <165172502+AndyKop@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:57:33 +0200 Subject: [PATCH 4/4] build fix --- data-explorer/kusto/query/max-of-function.md | 1 + 1 file changed, 1 insertion(+) diff --git a/data-explorer/kusto/query/max-of-function.md b/data-explorer/kusto/query/max-of-function.md index 54c14024db..2e247c5427 100644 --- a/data-explorer/kusto/query/max-of-function.md +++ b/data-explorer/kusto/query/max-of-function.md @@ -100,6 +100,7 @@ datatable (A: datetime, B: datetime) datetime(2024-12-15 10:45:00), datetime(2024-12-14 10:45:00) ] | project maxDate = max_of(A, B) +``` **Output**