List.First
The first item of a list, or a default when the list is empty.
Group: List. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
List.First(list as list, optional defaultValue as any) as any
| Parameter | Type | Description |
|---|---|---|
list | list | The list. |
defaultValue | any optional | What to give for an empty list; null when left out. |
Returns
any. The first item, or the default.
Examples
The first product
List.First({"Coffee", "Tea", "Milk"})
"Coffee"
An empty list with a default
List.First({}, "none")
"none"