List.SingleOrDefault
This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.
Returns a single item from a list.
List.SingleOrDefault(list as list, optional default as any) as any
| Argument | Description |
|---|---|
| List | The List to check. |
| optional default | Specifies a default value to be returned. |
If list is empty, a default value is returned instead.
If default is not specified, the default value of null is assumed.
If list has more than one item, an error is returned.
List.SingleOrDefault({1}) equals 1
List.SingleOrDefault({1, 2, 3}) equals error
List.SingleOrDefault({}, 0) equals 0
Show: