List.Count Function in Power Query

The List.Count function is a fundamental metadata tool in the Power Query M language. It evaluates a list and returns the total number of items contained within it.

Syntax

List.Count(list as list) as number

Parameters

Example: Find the number of values in the list.

Power Query M

let
  Source = {"India", "America", "Canada", "Japan", "Australia", "England"}, 
  Return = List.Count(Source)
in
  Return  

The output will be 6.

Example: Counting Rows in a Filtered Column

You can use List.Count on a specific column of a table to see how many entries are present after a transformation.

let
    TotalOrders = List.Count(SalesTable[OrderID])
in
    TotalOrders 

Common Use Cases

List.Count vs. List.NonNullCount

It is vital to choose the right counting function:
List.Count: Counts every single item, including null values.
List.NonNullCount: Only counts items that are not null.

Key Behaviors