minif() (aggregation function)
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Returns the minimum of Expr in records for which Predicate evaluates to true
.
- Can be used only in context of aggregation inside summarize
See also - min() function, which returns the minimum value across the group without predicate expression.
Syntax
minif
(
Expr,
Predicate)
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
Expr | string |
✔️ | Expression that will be used for aggregation calculation. |
Predicate | string |
✔️ | Expression that will be used to filter rows. |
Returns
The minimum value of Expr in records for which Predicate evaluates to true
.
Example
This example shows the minimum damage for events with casualties (Except 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)
Output
The results table shown includes only the first 10 rows.
State | MinDamageWithCasualties |
---|---|
TEXAS | 8000 |
KANSAS | 5000 |
IOWA | 45000 |
ILLINOIS | 100000 |
MISSOURI | 10000 |
GEORGIA | 500000 |
MINNESOTA | 200000 |
WISCONSIN | 10000 |
NEW YORK | 25000 |
NORTH CAROLINA | 15000 |
... | ... |