List.First

This function retrieves the initial item in the list provided, or a specified defaultValue if the list is empty. If no defaultValue is specified and the list is empty, the function will return null.

Syntax

List.First(list as list, optional defaultValue as any) as any

About

This function retrieves the initial item in the list provided, or a specified defaultValue if the list is empty. If no defaultValue is specified and the list is empty, the function will return null.

Explanation

Identify the initial value in the array {1, 2, 3}. Usage: The function Power Query MList.First({1, 2, 3}) is used to find the first value in the array. Output: The output will be 1. Identify the initial value in an empty array {}. If there are no values in the array, return -1. Usage: The function Power Query MList.First({}, -1) is used to identify the first value in an empty array. Output: The output will be -1.