Power QueryExercises

List.Sum

List function · By Tahir Nas · Examples run in our simulator · Published · Updated

Adds the numbers in a list.

When to use it

Use it to total a list or a column (Table[Column]), and inside Table.Group aggregations. Nulls are ignored, but text values cause an error, so type the column first.

Syntax

List.Sum(list as list, optional precision as nullable number) as any

Returns

The sum, ignoring nulls.

Example

List.Sum({2, 5, null, 1})

Result

8

Example: total a table column

Table[Column] is a list, so List.Sum can total it directly.

List.Sum(#table({"Region", "Rep", "Amount"}, {{"North", "Ana", 120}, {"South", "Bo", 80}, {"North", "Cy", 200}, {"South", "Ana", 50}})[Amount])

Result

450

Both results are produced by the Power Query Exercises simulator, an independent implementation of a documented subset of M, and checked on every build.

Good to know

Common mistakes

Exercises that use List.Sum

Learn more

Related functions

Official documentation: List.Sum on Microsoft Learn.