List.Max
The largest 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.Max(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 largest value, or the default.
Remarks
- Text compares by character code: every capital letter comes before every small one.
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 largest order
List.Max({120, 95, null, 130})
130
The latest delivery date
List.Max({#date(2024, 3, 4), #date(2024, 5, 12), #date(2024, 1, 30)})
#date(2024, 5, 12)
A default for no orders
List.Max({}, 0)
0