List.Skip Function (Power Query M)

List.Skip removes items from the start of a list and returns what’s left. Available in Excel (Power Query), Power BI Desktop, and Power BI Service.

If you want to drop the first few entries of a list, like a stray header row or a leading run of values you don’t need, this is the function to reach for.

Syntax of List.Skip Function

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

where

  • list (required, list). The list you want to skip leading items from.
  • countOrCondition (optional, any). Either a number (how many items to skip from the front), a condition function like each _ < 0, or null. Omit it to skip just the first item.

Returns: a list with the leading items removed. If the input is an empty list, an empty list is returned.

In plain terms, you hand it a list and tell it how much to skip off the top, and it gives back the rest.

Example 1: Skip a fixed number of items

Drop the first two items from a list of values.

List.Skip({10,20,30,40,50},2)

Result: {30, 40, 50}

The 2 skips 10 and 20 from the front, and everything after that stays.

Example 2: Skip just the first item

Leave out the second argument and List.Skip skips exactly one item.

List.Skip({10,20,30,40,50})

Result: {20, 30, 40, 50}

Only 10 is removed. This is the default when you don’t pass a count.

Example 3: Skip a leading run with a condition

Pass a condition function and List.Skip removes matching items from the start, stopping at the first one that doesn’t match.

List.Skip({-5,-2,-1,4,7,-3},each _ < 0)

Result: {4, 7, -3}

The leading negatives -5, -2, and -1 are skipped. At 4 the condition fails, so skipping stops. Note the trailing -3 stays, even though it’s negative.

Example 4: Skip more items than the list has

Ask to skip more items than exist and you get an empty list back, not an error.

List.Skip({10,20,30},5)

Result: {} (an empty list)

There are only three items, so skipping five removes all of them.

Example 5: Drop a leading label row from a column

One common real-world use is stripping a stray label off the top of a column before you work with the values.

Say you have a SalesData table where the first data row is a leftover heading.

Here is the starting data:

Region
Monthly Sales Report
North
South
East
West

Pull the column and skip the first value:

let
Source = Excel.CurrentWorkbook(){[Name="SalesData"]}[Content],
Column = Source[Region],
Result = List.Skip(Column,1)
in
Result

This drops the Monthly Sales Report label and keeps the real regions.

Result: {"North", "South", "East", "West"}

Things to keep in mind with List.Skip

  • No second argument means skip one item. Omitting countOrCondition (or passing null) skips exactly the first item, not zero and not all of them.
  • A number skips from the front only. List.Skip always removes leading items. To keep the last few instead, use List.LastN.
  • A condition skips the leading run, then stops. It removes matching items from the start and quits at the first non-match. It does not remove later matching items further down the list (see Example 3).
  • Over-skipping returns an empty list, not an error. Skip more than the list holds and you get {}. Handy when a count is calculated and might exceed the length.
  • Reach for a sibling when the shape is different. Use List.FirstN to keep the leading items, List.Range to grab a slice by offset and count, and Table.Skip to drop leading rows of a whole table instead of a single list.
  • It pairs well with other list operations. Skip leading items first, then reshape what’s left, for example sorting the rest with List.Sort, reworking each value with List.Transform, or testing for a value with List.Contains.

Common questions about List.Skip

What is the difference between List.Skip and Table.Skip?

List.Skip works on a list (a single column of values), while Table.Skip drops leading rows from an entire table, keeping all of its columns. Use Table.Skip when you want to remove header or junk rows from the table itself.

Is List.Skip the same as List.RemoveFirstN?

For the count form they do the same thing, removing N items from the front. List.Skip also accepts a condition function, so it can skip a leading run based on a test, which List.RemoveFirstN cannot.

List of All Power Query Functions

Related Power Query Functions / Articles:

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.