You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Kusto Query Language检查10行数据中是否存在6行Count值为0

使用Kusto查询语言检查10行数据中是否存在任意6行Count值为0

我有10行包含Time和Count两列的数据,需要通过Kusto Query Language检查这10行中是否存在任意6行的Count值为0。数据示例如下:

TimeCount
2022-09-01 17:23:00.00070
2022-09-01 17:24:00.000150
2022-09-01 17:25:00.000300
2022-09-01 17:26:00.000160
2022-09-01 17:27:00.000210
2022-09-01 17:28:00.000316
2022-09-01 17:29:00.000265
2022-09-01 17:30:00.000711
2022-09-01 17:31:00.000185
2022-09-01 17:32:00.000250

方案1:统计所有Count为0的总行数是否达标

如果只需要判断数据中Count为0的总行数是否≥6,用以下查询(替换YourTable为你的实际表名):

YourTable
| summarize ZeroCount = countif(Count == 0)
| extend HasSixZeros = ZeroCount >= 6

查询结果会返回两列:ZeroCount(Count为0的总行数)和HasSixZeros(布尔值,true表示满足条件)。

方案2:检查是否存在连续6行Count为0

如果需要验证是否存在连续的6行Count为0,用窗口函数实现:

YourTable
| sort by Time asc  // 按时间排序确保顺序正确
| extend IsZero = Count == 0
| extend ConsecutiveZeros = row_cumsum(IsZero, not(IsZero))  // 计算连续0的行数,遇到非0行重置
| summarize MaxConsecutiveZeros = max(ConsecutiveZeros)
| extend HasSixConsecutiveZeros = MaxConsecutiveZeros >= 6

结果中的MaxConsecutiveZeros是最大连续0的行数,HasSixConsecutiveZeros会返回是否存在连续6行0的判断结果。


内容的提问来源于stack exchange,提问作者VKR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 07:36:23