List.LastN

 

This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.

Returns the last set of items in a list by specifying how many items to return or a qualifying condition.

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

ArgumentDescription
listThe List to check.
optional countOrConditionNumber items to return or a qualifying condition.
  • If a number is specified, up to that many items are returned.

  • If a condition is specified, all items are returned that initially meet the condition.

  • Once an item fails the condition, no further items are considered

List.LastN({3, 4, 5, -1, 7, 8, 2},1) equals  { 2 }  

Show: