List.Median

List

Returns the median value of a list.

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

Syntax

List.Median(list as list, optional comparisonCriteria as any) as any

Parameters

NameTypeRequiredDescription
listlistYesThe list of values to evaluate.
comparisonCriteriaanyNoA comparer or key selector for custom ordering.

Return Value

anyThe median value of the list. For even-length lists of numbers, returns the arithmetic mean of the two middle values.

Remarks

List.Median returns the middle value of a sorted list. For numeric lists with an even number of elements, it returns the average of the two middle values. For non-numeric lists, it returns the lower middle value.

Null values are ignored. If the list is empty or contains only nulls, null is returned.

Examples

Example 1: Median of an odd-length list

List.Median({3, 1, 4, 1, 5})
Result
Result
13

Example 2: Median of an even-length list

List.Median({1, 2, 3, 4})
Result
Result
12.50

Compatibility

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