List.Count
How many items a list holds, nulls included.
Group: List. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
List.Count(list as list) as number
| Parameter | Type | Description |
|---|---|---|
list | list | The list to count. |
Returns
number. The number of items; 0 for an empty list.
Remarks
- Every item counts, null too.
List.NonNullCountleaves the nulls out.
Examples
Order lines, one without a product yet
List.Count({"Coffee", "Tea", null, "Milk"})
4
The null is an item like any other, so the count is 4.