Table.RemoveLastN
This function retrieves a table from the input table without including the last countOrCondition rows. The amount of rows removed is based on the optional parameter countOrCondition. If countOrConditi...
This function retrieves a table from the input table without including the last countOrCondition rows. The amount of rows removed is based on the optional parameter countOrCondition. If countOrCondition is not provided, only the last row is excluded. When countOrCondition is a number, that specific number of rows from the bottom will be excluded. If countOrCondition is a condition, rows that satisfy the condition will be excluded until a row no longer meets the condition.
Example 1
Delete the bottom row from the provided table.
Usage:
In Power Query M language, use the function MTable.RemoveLastN() with the Table.FromRecords() function to remove the last row from the table.
Output:
The resulting table will have the last row removed.
Example 2
Remove the last rows from the table where the CustomerID is greater than 2.
Usage:
Use the Power Query M function MTable.RemoveLastN() with the Table.FromRecords() function to eliminate the rows where CustomerID is greater than or equal to 2.
Output:
The resulting table will have the rows where CustomerID is greater than 2 removed.