Power Query
published
Search
K

List.Last

List.Last

Returns the last value of the list or the specified default if empty.
function (list as list, optional defaultValue as nullable any) as nullable any

Description

Returns the last item in the list list, or the optional default value, defaultValue, if the list is empty. If the list is empty and a default value is not specified, the function returns null.

Category

List.Selection

Examples

Find the last value in the list {1, 2, 3}.
List.Last({1, 2, 3})
3
Find the last value in the list {} or -1 if it empty.
List.Last({}, -1)
-1