List.Max

This function identifies and returns the highest value within a given list. If the list is empty, it returns an optional default value instead. Users can also specify a comparison criteria to dictate ...

Syntax

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

About

This function identifies and returns the highest value within a given list. If the list is empty, it returns an optional default value instead. Users can also specify a comparison criteria to dictate how items in the list should be compared. If no criteria is provided, the default comparer will be used.

Explanation

Example 1 Determine the highest value in the set {1, 4, 7, 3, -2, 5}. Usage: In Power Query M language, utilize the function MList.Max({1, 4, 7, 3, -2, 5}, 1). Output: 7 Example 2 Identify the maximum value in an empty list and return -1 if the list is empty. Usage: In Power Query M language, use the function MList.Max({}, -1). Output: -1