Read the M behind the Applied Steps
Read a generated query and say what each step does and which step it depends on.
~10 min read · beginner · Module 1: How Power Query thinks
By Tahir Nas · Examples run in our simulator · Updated
Before this: Applied steps are a recipe, not a one-off edit
You don't have to write M to use Power Query, but being able to read it pays off quickly. When a step fails, the formula bar shows its M, and the error message names functions and columns. This lesson maps the step names the editor generates to the functions behind them.
Step names and their functions
| Step name in the pane | Function | What it does |
|---|---|---|
| Promoted Headers | Table.PromoteHeaders | First row becomes the column names |
| Changed Type | Table.TransformColumnTypes | Sets column types |
| Filtered Rows | Table.SelectRows | Keeps rows matching a condition |
| Removed Other Columns | Table.SelectColumns | Keeps only the listed columns |
| Renamed Columns | Table.RenameColumns | Renames from {old, new} pairs |
| Sorted Rows | Table.Sort | Orders rows by one or more keys |
| Added Custom | Table.AddColumn | Adds a calculated column |
| Grouped Rows | Table.Group | Summarises rows per key |
| Merged Queries | Table.NestedJoin | Joins another table as a nested column |
| Unpivoted Other Columns | Table.UnpivotOtherColumns | Turns columns into attribute/value rows |
The step name is only a label; you can rename it freely. The function is what runs. A step called Removed Other Columns actually calls Table.SelectColumns, which is why it keeps a fixed list of columns.
Quoted names and comments
Step names with spaces are written #"Added Custom". Names without spaces or special characters, such as Source, need no quotes. Lines starting with // are comments; the engine ignores them, and they're a good place to record why a step exists.
Steps don't have to use the previous step
Most steps take the step directly above as input, but any step may refer to any earlier name. Here a helper step computes a total from Source, and the last step uses both:
let
Source = #table({"Item", "Qty"}, {{"Kite", 4}, {"Reel", 1}, {"Line", 5}}),
// Grand total of the whole source, used by the share calculation below
TotalQty = List.Sum(Source[Qty]),
#"Added Share" = Table.AddColumn(Source, "Share", each [Qty] / TotalQty, type number)
in
#"Added Share"Result
| Item | Qty | Share |
|---|---|---|
| Kite | 4 | 0.4 |
| Reel | 1 | 0.1 |
| Line | 5 | 0.5 |
Output produced by the Power Query Exercises simulator, an independent implementation of a documented subset of M.
TotalQty is a number, not a table, and it appears as its own step in the pane.When you read an unfamiliar query, trace these references. A step that isn't used by anything later is dead code, and a step referenced by several others is a natural place to add a check.
A reading routine
- Start at
into see which step is returned. - Walk upwards, noting each step's input name.
- For each step, name the function and its key arguments: which columns, which condition.
- Look for hard-coded values (column lists, dates, file paths) that may break on refresh.
Where to find this in Excel
- Excel for Windows
- Power Query editor > View > Advanced Editor (also Home > Advanced Editor)
- What you see
- A window shows the whole query as M, one named step per line, and tells you if the syntax is valid.
Paths are for the Power Query editor in Excel for Microsoft 365, checked against Microsoft's documentation on 8 November 2026: Use Power Query to transform data (the Power Query editor) (Microsoft Learn); Using custom functions (Microsoft Learn).
Common mistakes
- Trusting the step name: a step renamed to Filter completed could contain any function.
- Assuming every step uses the one directly above it, and missing a step that references
Sourceagain. - Deleting a step that looks unused in the pane but is referenced by a later step's formula.
Excel, Power BI and the simulator
- The formula bar (View → Formula Bar) shows one step's M; the Advanced Editor shows the whole query. Both exist in Excel and Power BI Desktop.
- Step names generated by the editor follow the host's display language, so a German Excel shows different default names for the same functions.
- In the simulator, the M editor shows the whole query and the step list updates from the
letbindings.
Next step
Check that the ideas in this lesson stuck. The quiz explains every answer, including the wrong ones.
Take the Power Query basics quiz