Downloads
Power Query MLanguageBeginner

let

Names a series of steps so that each one can be read, and then gives the result in the in clause.

Syntax
let name = expression, name2 = expression2 in result

Returns: The value of the expression after in, which is the result of the query.

What it does

Every query in Power Query is built with let and in. Between them you write steps: each step has a name, an equals sign and an expression. A later step can use any earlier one by name. The in clause says which step is the answer. The Applied Steps pane in the editor is a picture of these steps, in the order you wrote them.

Syntax and arguments

Example

A query for the March bank file: read the file, drop the header lines and keep only the debits, with a named step for each action.

let
    Source = Csv.Document(File.Contents("C:\Banking\statement-2026-03.csv"), [Delimiter = ","]),
    Headers = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),
    Debits = Table.SelectRows(Headers, each [Type] = "DEBIT"),
    #"Debits typed" = Table.TransformColumnTypes(Debits, {{"Amount", type number}})
in
    #"Debits typed"

Each name describes what that step does, so a reviewer can read the query from top to bottom. Changing the final in line changes which step is returned, which is a quick way to test an earlier step.

Example: a second, different use

Using a step name that refers to an earlier step inside an each function is the same idea: names let you reuse a result without writing it twice.

Things to watch

In business terms

Named steps make a query something you can explain to an auditor: each step is a documented transformation. Keep the names short and meaningful, such as "Removed test rows" or "Converted to USD".

Related functions

All Power Query M functions · View as Markdown · M basics