minif()(聚合函数)

返回 Predicate 计算结果为 true 的记录中 Expr 的最小值。

  • 只能在 summarize 内的聚合上下文中使用

另请参阅 - min() 函数,该函数在不使用谓词表达式的情况下返回组中的最小值。

语法

minif(Expr,Predicate)

详细了解语法约定

参数

客户 类型​​ 必需 说明
Expr string 用于聚合计算的表达式。
Predicate string 将用于筛选行的表达式。

返回

Predicate 计算结果为 true 的记录中 Expr 的最小值。

示例

此示例显示了有人员伤亡事件的最小损失(0 除外)

StormEvents
| extend Damage=DamageCrops+DamageProperty, Deaths=DeathsDirect+DeathsIndirect
| summarize MinDamageWithCasualties=minif(Damage,(Deaths >0) and (Damage >0)) by State 
| where MinDamageWithCasualties >0 and isnotnull(MinDamageWithCasualties)

输出

显示的结果表仅包括前 10 行。

状态 MinDamageWithCasualties
德克萨斯 8000
KANSAS 5000
衣阿华州 45000
ILLINOIS 100000
MISSOURI 10000
佐治亚州 500000
明尼苏达州 200000
威斯康星州 10000
NEW YORK 25000
NORTH CAROLINA 15000
... ...