OpenBI Docs Buy

List.Average

The mean of a list's values: numbers, durations, dates or datetimes, nulls left out.

Group: List. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

List.Average(list as list, optional precision as nullable number) as any
ParameterTypeDescription
listlistThe values to average; nulls are skipped.
precisionnullable number
optional
Precision.Double (the default) works in double-precision numbers; Precision.Decimal in decimals of 15 significant digits.

Returns

any. A value of the items' kind (a number for numbers, a duration for durations); null when there is nothing but null.

Remarks

  • A null is not a zero: it is left out of both the total and the count.
  • The mean is worked out as Power Query works it out, from the first value and each value's distance to it, so the mean of 0.1, 0.2 and 0.3 comes out as exactly 0.2.

Examples

Average order value

List.Average({120, 80, null, 100})
100

Three values count; the null does not.

Average call length

List.Average({#duration(0, 0, 30, 0), #duration(0, 0, 45, 0)})
#duration(0, 0, 37, 30)

List.Sum, List.Median, List.StandardDeviation.

Last updated · OpenBI Studio 0.3.79