List.Range

List

Returns a subset of items from a list starting at a given offset.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

List.Range(list as list, offset as number, optional count as nullable number) as list

Parameters

NameTypeRequiredDescription
listlistYesThe list to take items from.
offsetnumberYesThe zero-based index of the first item to return.
countnumberNoThe number of items to return. If omitted, returns all items from the offset onward.

Return Value

listA list containing items from the specified offset for the given count.

Remarks

List.Range returns a slice of a list, starting at a zero-based offset. This is the list equivalent of Table.Range.

Examples

Example 1: Get a range of products

let
    Names = Table.Column(Products, "ProductName"),
    Subset = List.Range(Names, 1, 3)
in
    #table({"ProductName"}, List.Transform(Subset, each {_}))
Result
ProductName
1Gadget B
2Widget C
3Gadget D

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks