List.Max

List

Returns the maximum value from a list.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

List.Max(list as list, optional default as nullable any, optional comparisonCriteria as any, optional includeNulls as nullable logical) as any

Parameters

NameTypeRequiredDescription
listlistYesThe list to search.
defaultanyNoValue returned when the list is empty. Defaults to null.
comparisonCriteriaanyNoA comparer or key selector for custom ordering.
includeNullslogicalNoWhether to include null values in the comparison. Defaults to false.

Return Value

anyThe 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 1: Find the maximum of a list of numbers

List.Max({5, 3, 8, 1, 9})
Result
Result
19

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
112/30/2024

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks