Power Query List.Skip: Step-by-Step Guide
In this article
List.Skip returns a list after removing a specified number of items from the start. Use it when you need to drop header rows, skip blank entries, or start processing from a known offset. The function is available in Power Query for Excel, Power BI, and other Microsoft data tools; the steps below work in the Power Query Editor.
What You'll Need
- Access to Power Query Editor (in Excel: Data > Get Data > Launch Power Query Editor; in Power BI Desktop: Transform data).
- A query that returns a list or a table you can convert to a list (for example, a column).
- Basic familiarity with the formula bar and the Advanced Editor.
Step-by-Step
- Open the Power Query Editor and select the query you want to work on. If you are starting from a table, you will typically convert a column to a list first (right-click the column header and choose Drill Down, or use the Table.Column function in a custom step).
- Locate the list you want to skip items from. In the Applied Steps pane, click the step that produces the list. The formula bar will show something like
= {1, 2, 3, 4, 5}or= Table.Column(Source, "Column1"). - Add a new step by clicking the fx icon next to the formula bar (or right-click the step and choose Insert Step After). In the formula bar, type
= List.Skip(followed by the list expression and the number of items to skip, separated by a comma, then close the parenthesis. For example:= List.Skip({1, 2, 3, 4, 5}, 2)returns{3, 4, 5}. - Press Enter to commit the step. The result preview will show the remaining items. If you are working with a table column, you can use
List.Skip(Table.Column(Source, "Column1"), 1)to skip the first value in that column. - Rename the step if needed (right-click the step and choose Rename) to something descriptive like "Skip first 2 rows".
- Use the result in subsequent steps. For example, you can convert the list back to a table with
Table.FromListor use it in a function likeList.Sum.
Common Mistakes
- Skipping more items than exist: If you specify a count larger than the list length, List.Skip returns an empty list. Check the list size with
List.Countfirst. - Using a negative count: The count must be a non-negative number. A negative value will cause an error.
- Forgetting to convert a table to a list: List.Skip works on lists, not tables. If you pass a table, you will get an error. Use
Table.ColumnorTable.ToListto get a list first. - Misplacing the step: Ensure the step references the correct previous step name. The Applied Steps pane shows the exact names.
- Assuming List.Skip modifies the original list: It returns a new list; the original remains unchanged.
Tips
- Use
List.Skip(list, 0)to return the original list (useful for testing). - Combine with
List.FirstNorList.LastNto take specific portions. - If you need to skip based on a condition, use
List.SkipWhileinstead. - For skipping rows in a table, use
Table.Skiprather than converting to a list. - Document your steps with comments using
//in the Advanced Editor for clarity.
Troubleshooting
If List.Skip returns an error, check the following:
- Error: "We cannot convert a value of type Table to type List" — You passed a table. Convert it to a list using
Table.ColumnorTable.ToList. - Error: "The count must be a non-negative number" — Ensure the second argument is a number >= 0.
- Result is empty when you expected items — The count may be too large. Use
List.Countto verify the list length. - Step not updating — Check that the step references the correct previous step name. Rename steps to avoid confusion.
- Formula syntax error — Ensure parentheses and commas are correct. In the Advanced Editor, use proper M syntax.
If the issue persists, try simplifying the expression by breaking it into smaller steps, or use the Advanced Editor to inspect the full M code.
Frequently Asked Questions
What is the difference between List.Skip and Table.Skip?
List.Skip removes items from a list, while Table.Skip removes rows from a table. Use Table.Skip when working directly with tables.
Can I skip items from the end of a list?
No, List.Skip only removes items from the beginning. To remove from the end, use List.FirstN with a count equal to the total length minus the number to remove, or reverse the list with List.Reverse, skip, then reverse again.
What happens if I skip zero items?
List.Skip(list, 0) returns the original list unchanged.
Is List.Skip case-sensitive?
List.Skip is a function and is case-sensitive in M code: use List.Skip with exact capitalization.
Can I use a variable for the count?
Yes, you can use any expression that evaluates to a number, such as a parameter or a calculated value.
Does List.Skip work with nested lists?
Yes, it treats the outer list as a sequence and skips entire items, regardless of their content.