首页 > 解决方案 > 将日期表传递给 Kusto 中的范围函数

问题描述

在 Kusto 查询语言中,是否可以将一列日期传递给范围?我正在尝试沿这些日期呈现时间线图表映射 table4 值。todatetime("1598149365")将工作,但不是 table_dates3。或者,如果有一些类似的方法可以做到这一点。

TableName
| where Name == "abc"
| project table_dates1, table_dates2, table_dates3, table4
| make-series num=count() default=0 on todatetime(table_dates1) in range(todatetime(table_dates2), todatetime(table_dates3), 1h) by table4
| render timechart

标签: mysqldatabasedateazure-data-explorerkql

解决方案


您应该使用“[from start] [to end] step step”语法而不是旧的 range() 语法。“from”和“to”是可选的,如果未提供,它们将是每个时间序列的最小/最大时间。所以也许是这样的:

TableName
| where Name == "abc"
| project table_dates1, table_dates2, table_dates3, table4
| make-series num=count() on todatetime(table_dates1) step 1h by table4
| render timechart

推荐阅读