List.Max
ListReturns the maximum value from a list.
Syntax
List.Max(list as list, optional default as nullable any, optional comparisonCriteria as any, optional includeNulls as nullable logical) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to search. |
default | any | No | Value returned when the list is empty. Defaults to null. |
comparisonCriteria | any | No | A comparer or key selector for custom ordering. |
includeNulls | logical | No | Whether to include null values in the comparison. Defaults to false. |
Return Value
any — The largest value in the list, or the default value if the list is empty.
Remarks
List.Max returns the largest value in a list. Null values are excluded from comparison by default. If the list is empty, null is returned unless a default value is provided.
The optional comparisonCriteria parameter accepts a comparer function or a key selector (for example, each Text.Length(_) to find the longest text).
Use List.Max on a table column by first extracting it with Table.Column.
Examples
Example 2: Find the latest date in a column
let
Dates = Table.Column(Sales, "OrderDate"),
Latest = List.Max(Dates)
in
#table({"LatestOrder"}, {{Latest}})Applied Steps
The final output — wraps the latest date into a single-row table with a "LatestOrder" column header.
LatestOrder | |
|---|---|
| 1 | 12/30/2024 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks