Search code examples
azure-data-explorerkql

Kusto Query Earliest and Latest date in the Past 21 days


So I am new to kusto and I am trying to get the min and max dates of the past 21 days in a kusto query and I want to project those min and max dates.

How do I modify this simple query to get the min and max dates of the past 21 days?

customEvents
| where timestamp >= ago(21d)
| project timestamp

Solution

  • You can use summarize with max() and min() like this:

    customEvents
    | where timestamp >= ago(21d)
    | summarize min(timestamp), max(timestamp)