List.Single

If the list contains only one item, the function will return that item. However, if there are multiple items in the list or if the list is empty, an exception will be thrown.

Syntax

List.Single(list as list) as any

About

If the list contains only one item, the function will return that item. However, if there are multiple items in the list or if the list is empty, an exception will be thrown.

Explanation

Example 1 Locate the only value in the collection {1}. Method of use: Power Query MList.Single({1}) Result: 1 Example 2 Locate the only value in the collection {1, 2, 3}. Method of use: Power Query MList.Single({1, 2, 3}) Output: [Expression.Error] The operation could not be completed due to the presence of multiple elements in the collection.