List.IsEmpty

List

Returns true if the list contains no elements.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

List.IsEmpty(list as list) as logical

Parameters

NameTypeRequiredDescription
listlistYesThe list to check.

Return Value

logicalTrue if the list has zero elements; false otherwise.

Remarks

List.IsEmpty returns true if the list has zero items. It is equivalent to List.Count(list) = 0 but expresses intent more clearly. The primary use case is defensive branching: before calling List.First, List.Single, or any aggregation function on a filtered list, check List.IsEmpty to avoid errors when no results exist.

A list containing only null values is not empty — it has elements, they are simply null. An empty list is one with no elements at all: {}.

Compared to List.Count, List.IsEmpty does not need to count all elements — it only needs to check for the existence of any element, which can be more efficient on large lazy lists. For the inverse check, use not List.IsEmpty(list) rather than comparing count to a number.

Examples

Example 1: Empty list

List.IsEmpty({})
Result
Result
1TRUE

Example 2: Non-empty list

List.IsEmpty({1, 2, 3})
Result
Result
1FALSE

Example 3: Check if a filter returned results before accessing

let
    Values = {10, 20, 30},
    Filtered = List.Select(Values, each _ > 50),
    Result = if List.IsEmpty(Filtered) then null else List.First(Filtered)
in
    Result
Result
Result
1null

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks