0

考虑以下查询:

这将为 bin_duration 的固定值生成 1 个单元格结果:

events
| summarize count() by id, bin(time , bin_duration) | count

我希望生成一个带有 bin_duration 变量值的表。

bin_duration 将从下表中获取值:

range bin_duration from 0 to 600 step 10;

所以决赛桌看起来像这样:

bin_duration

我该如何实现这一目标?

谢谢

4

1 回答 1

0

bin(value,roundTo)aka ,将向下floor(value,roundTo)value入到最接近的倍数roundTo,因此您不需要外部表。

events 
| summarize n = count() by bin(duration,10) 
| where duration between(0 .. 600) 
| order by duration asc

您可以在Stormevents教程中尝试一下:

let events = StormEvents | extend duration = (EndTime - StartTime) / 1h;
events 
| summarize n = count() by bin(duration,10) 
| where duration between(0 .. 600) 
| order by duration asc 

在处理时间序列数据时,bin()还要了解方便的时间跨度文字,例如:

let events = StormEvents | extend duration = (EndTime - StartTime);
events 
| summarize n = count() by bin(duration,10h) 
| where duration between(0h .. 600h) 
| order by duration asc 
于 2019-05-25T13:41:29.743 回答