Skip to content

Instantly share code, notes, and snippets.

@madd0
Created April 21, 2020 13:45
Show Gist options
  • Save madd0/0baed3ee13ae6795d38f88c4a79a87b4 to your computer and use it in GitHub Desktop.
Save madd0/0baed3ee13ae6795d38f88c4a79a87b4 to your computer and use it in GitHub Desktop.
Add "empty" bins to a kusto query
let Start=startofday(ago(2d));
let Stop=startofday(ago(1d));
requests
| where timestamp >= Start and timestamp < Stop
| summarize Count=count() by bin(timestamp, 1h)
| union (
range x from 1 to 1 step 1
| mv-expand timestamp=range(Start, Stop, 1h) to typeof(datetime)
| extend Count = 0
)
| summarize Count = sum(Count) by bin(timestamp, 1h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment