List.Average

Updated on

List.Average is a Power Query M function that calculates the average value for items in a list. The function returns the average value in the same datatype as the list’s values, working with number, date, time, datetime, datetimezone, and duration values.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

List.Average(
   list as list,
   optional precision as nullable number,
) as any
Argument Attribute Description
list
precision optional The Precision.Type specifies the accuracy level for calculations. When omitting this argument, Power Query uses Precision.Double by default, which, while efficient, may cause rounding errors with very small fractions. For greater accuracy Precision.Decimal offers a more precise number representation, ideal for tasks requiring high precision.

Description

Returns the average value for the items in the list, list. The result is given in the same datatype as the values in the list. Only works with number, date, time, datetime, datetimezone and duration values. If the list is empty null is returned.

Examples

Find the average of the list of numbers, {3, 4, 6}.

// Output: 4.333333333333333
List.Average( {3, 4, 6} )

Find the average of the date values January 1, 2011, January 2, 2011 and January 3, 2011.

// Output: #date( 2011, 1, 2 )
List.Average( {#date( 2011, 1, 1 ), #date( 2011, 1, 2 ), #date( 2011, 1, 3 )} )

Learn more about List.Average in the following articles:

Other functions related to List.Average are:

BI Gorilla Blog

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/list-average