List.Range
ListReturns a subset of items from a list starting at a given offset.
Syntax
List.Range(list as list, offset as number, optional count as nullable number) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to take items from. |
offset | number | Yes | The zero-based index of the first item to return. |
count | number | No | The number of items to return. If omitted, returns all items from the offset onward. |
Return Value
list — A 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 | |
|---|---|
| 1 | Gadget B |
| 2 | Widget C |
| 3 | Gadget D |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks