List.Transform
ListApplies a function to each item in a list and returns the results.
Syntax
List.Transform(list as list, transform as function) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list of items to transform. |
transform | function | Yes | The function to apply to each item. |
Return Value
list — A new list with the transform function applied to each item.
Remarks
List.Transform applies a function to every item in a list, returning a new list of the same length. This is equivalent to a "map" operation in other languages. Use each syntax for simple transformations.
Examples
Example 1: Double all quantities
let
Quantities = Table.Column(Table.FirstN(Sales, 4), "Quantity"),
Doubled = List.Transform(Quantities, each _ * 2)
in
#table({"DoubledQty"}, List.Transform(Doubled, each {_}))Result
DoubledQty | |
|---|---|
| 1 | 8 |
| 2 | 4 |
| 3 | 20 |
| 4 | 2 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks