List.Skip

Updated on

List.Skip is a Power Query M function that skips a specified number of items in a list or items until a specified condition is met. The function returns a modified list with the specified items skipped.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

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

Description

The List.Skip function creates a new list by removing elements from an existing one. By default, it removes the first element, but you can customize how many elements to skip or even specify a condition to determine which elements get left out. If you feed it an empty list, it will simply return another empty list.

In case you provide the optional countOrCondition argument, the function supports the following input:

  • Number Specified: If you provide a specific number, the function will skip that many items from the beginning of the list.
  • Condition Specified: If you give a condition, the function skips all elements that meet this condition. As soon as an element fails to meet the condition, the function stops considering any more items for exclusion.
  • Null Parameter: If this parameter is left null or unspecified, the function reverts to its default behavior, which is to skip just the first item in the list.

Examples

The List.Skip function can be used in several ways.

Basic Usage: Skipping the First Element

Let’s start simple. Imagine you have a list consisting of the numbers 1 through 5 and you want to create a new list that skips the first number. Here’s how to do it:

// Output: { 2, 3, 4, 5 }
List.Skip( { 1, 2, 3, 4, 5 } )

Just like that, the new list starts from 2, leaving out the first number 1.

Handling Empty Lists

But what if you have an empty list? Don’t worry, the function has you covered. When the list is empty, the function will simply return another empty list.

// Output: { }
List.Skip( { } )

Skipping N number of Items using a Count

Things start getting more interesting when you want to skip more than just one item from the list. For instance, if you’d like to remove the first three numbers from the list {1, 2, 3, 4, 5}, you can specify the count of items to skip like so:

// Output: { 4, 5 }
List.Skip( { 1, 2, 3, 4, 5 }, 3 )

And if you want to keep all the values intact, simply specify zero as the count.

// Output: { 1, 2, 3 }
List.Skip( { 1, 2, 3 }, 0 )

Adding Conditions: More Control Over Skipping

Now, let’s say you want to skip elements based on certain conditions, like their value. The countOrCondition argument can also take a condition, making it more useful.

For example, to create a list that skips all items from the start that are less than or equal to 3, you would do:

// Output: { 2, 6, 1 }
List.Skip( { 5, 4, 2, 6, 1 }, each _ > 3 )

How can we explain this result? Power Query checks each item in order. It keeps skipping as long as the condition is true.
In this case:

  • It skips 5 → true
  • It skips 4 → true
  • It stops at 2 → false

Even though 6 also meets the condition, skipping has already stopped once 2 failed the test. From that point on, all remaining items are kept.

If you want to skip items as long as they are odd numbers, you can use:

// Output: { 4, 5, 6 }
List.Skip( { 1, 3, 4, 5, 6 }, each Number.IsOdd( _ ) )
  • It skips 1 → true
  • It skips 3 → true
  • It stops at 4 → false

Now it keeps everything from 4 onward, even if later values (like 5) would still meet the condition.

If your list contains a mix of positive, negative, and zero values and you’d like to skip the initial positive values, you can use:

// Output: { -1, -2 }
 List.Skip( {4, 3, 2, -1, -2}, each _ >= 0 )

And guess what? List.Skip isn’t limited to just numbers. You can use it with text values too. For instance, if you have a list of fruits and want to exclude the ones with names shorter than 6 characters, you can use the Text.Length function as your condition.

// Output: { "banana", "cherry", "date" }
List.Skip( {"apple", "banana", "cherry", "date"}, each Text.Length(_) < 6 )

The result is explained by:

  • It skips “apple” → true (length 5)
  • It stops at “banana” → false (length 6)

Now all following items are kept, even if they would meet the condition again (like “date”, which has 4 letters but stays in the result).

Key rule for the examples: List.Skip stops skipping as soon as it hits the first item that fails the condition.From that point on, no further checks are made, everything else is returned.

Learn more about List.Skip in the following articles:

Other functions related to List.Skip are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/list-skip

2023-2026 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy