List.Min
The smallest value of a list, nulls left out, or a default for an empty list.
Group: List. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
List.Min(list as list, optional default as any, optional comparisonCriteria as any, optional includeNulls as nullable logical) as any
| Parameter | Type | Description |
|---|---|---|
list | list | The values to compare: numbers, texts, dates and other values that order. |
default | any optional | What to give for an empty list; null when left out. |
comparisonCriteria | any optional | How to order the values: a comparer or a key function. OpenBI does not use it yet and compares the values themselves. |
includeNulls | nullable logical optional | Whether nulls take part. OpenBI does not use it yet: nulls are always left out. |
Returns
any. The smallest value, or the default.
Compared with Power Query
Power Query orders the values by comparisonCriteria and lets nulls take part when includeNulls is true; OpenBI does not use these two parameters yet.
Examples
The cheapest product
List.Min({23.5, 8, null, 12.9})
8
The null is left out, so the answer is a price.
The first order date
List.Min({#date(2024, 3, 4), #date(2024, 1, 30)})
#date(2024, 1, 30)
A default for no prices
List.Min({}, 0)
0