List.Last
The last 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.Last(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 last item, or the default.
Examples
The latest reading
List.Last({412, 418, 431})
431
An empty list with a default
List.Last({}, 0)
0