Table.Last

This function retrieves the final row from the table. If the table has no rows, it will return the default value provided.

Syntax

Table.Last(table as table, optional default as any) as any

About

This function retrieves the final row from the table. If the table has no rows, it will return the default value provided.

Explanation

Retrieve the final row of the table using the Power Query M function MTable.Last. If the table is empty, the function will return the row [a = 0, b = 0]. Example 1: Input: MTable.Last( Table.FromRecords({ [CustomerID = 1, Name = "Bob", Phone = "123-4567"], [CustomerID = 2, Name = "Jim", Phone = "987-6543"], [CustomerID = 3, Name = "Paul", Phone = "543-7890"] }) ) Output: [CustomerID = 3, Name = "Paul", Phone = "543-7890"] Example 2: Input: MTable.Last(Table.FromRecords({}), [a = 0, b = 0]) Output: [a = 0, b = 0]