List.Transform

List

Applies a function to each item in a list and returns the results.

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

Syntax

List.Transform(list as list, transform as function) as list

Parameters

NameTypeRequiredDescription
listlistYesThe list of items to transform.
transformfunctionYesThe function to apply to each item.

Return Value

listA 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
18
24
320
42

Compatibility

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