List.RemoveLastN Function in Power Query

The List.RemoveLastN function returns the resultant list after removing the specified number of items from the last. The number of elements removed depends on the optional countOrCondition parameter.

Syntax

List.RemoveLastN(list as list, optional countOrCondition as any) as list

Example: Remove the last two items from the list.

Power Query M

let
  Source = {"India", "America", "Canada", "Japan", "Australia", "England"}, 
  RemoveItemsinList = List.RemoveLastN(Source, 2)
in
  RemoveItemsinList

The output will be shown in the following image:

List.RemoveLastN function in Power Query