Table.RemoveFirstN
This function retrieves a table without the initial set number of rows specified by the 'countOrCondition' parameter from the input table 'table'. The number of rows excluded is determined by the opti...
This function retrieves a table without the initial set number of rows specified by the 'countOrCondition' parameter from the input table 'table'. The number of rows excluded is determined by the optional 'countOrCondition' parameter. If 'countOrCondition' is not provided, only the first row is excluded. If 'countOrCondition' is a numerical value, that specific number of rows will be excluded starting from the top. If 'countOrCondition' is a condition, rows that satisfy the condition will be excluded until a row that does not meet the condition is encountered.
Example 1
Eliminate the initial row from the data table.
Usage:
In Power Query M language:
Table.RemoveFirstN(
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
}),
1)
Output:
Table.FromRecords({
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
})
Example 2
Remove the first two rows from the tabular data.
Usage:
Utilizing Power Query M language:
Table.RemoveFirstN(
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
}),
2)
Output:
Table.FromRecords({