Sub topic 3
Working in the Power Query Editor and Applied Steps
This chapter assumes you can build an Excel table and have already loaded data with Get & Transform. It covers the editor's layout, how Applied Steps record your work, and the errors people hit most often when editing steps.
The editor layout
The Power Query Editor opens in its own window when you choose Transform Data or edit an existing query. It has four main areas:
- Ribbon: Commands grouped by task (Transform, Add Column, View).
- Queries pane (left): Every query in the workbook.
- Data preview (center): A sample of the current step's result, not the whole table.
- Query Settings pane (right): The query name and the Applied Steps list.
If the Query Settings pane or the formula bar is hidden, turn them on from View.
How Applied Steps work
Each action you take adds one step to the list. The step records what you did. It does not change the source. When you refresh, Power Query runs the steps again from the top, in order, against the current source data.
Clicking a step shows the data as it looked after that step. Every step has a name and an M formula. Select a step and read the formula bar to see it.
let
Source = Excel.CurrentWorkbook(){[Name="SalesRaw"]}[Content],
Typed = Table.TransformColumnTypes(Source, {{"Date", type date}, {"Amount", type number}}),
Trimmed = Table.TransformColumns(Typed, {{"Region", each Text.Trim(Text.Clean(_)), type text}})
in
TrimmedEach line is one applied step. The step Typed takes the output of Source. The step Trimmed takes the output of Typed. The final in line names the step whose result becomes the query's output.
Editing, reordering, and deleting steps
Right-click a step to see the options:
| Action | What it does | Watch for |
|---|---|---|
| Rename | Gives the step a readable name | Later steps update their references automatically |
| Edit Settings | Reopens the step's dialog | Available only for steps built from a dialog |
| Move Up / Move Down | Changes the order | A step may refer to a column that does not exist yet |
| Delete | Removes the step | Later steps may break |
| Delete Until End | Removes this step and every step after it | Cannot be undone from the list |
| Insert Step After | Adds a step in the middle | See the warning below |
You can also edit the formula in the formula bar directly. This is useful for small fixes, such as changing a column name.
Common errors
- "The column 'X' of the table wasn't found." A step refers to a column that was renamed, removed, or not yet created. Check the step order and the column name, including case and trailing spaces.
- A step shows a warning icon. Select it and read the message. The cause is often a type conversion on a value such as
N/A. - A removed step cannot be recovered. Closing the editor with Close & Load keeps the changes. Closing with Close without saving discards them.
- The preview looks fine but the result is wrong. The preview uses a sample of the data. Check the loaded table after a refresh.
Exercise
A query has these steps in order: Source, Promoted Headers, Changed Type, Removed Columns. You move Promoted Headers to after Removed Columns, and the query now fails. What is the most likely cause, and how do you fix it?
Show answer
The steps before Promoted Headers now run on a table whose headers have not been promoted, so the columns are named Column1, Column2 and so on. The later steps refer to column names that do not exist yet. Move Promoted Headers back up, directly after Source, so that column names exist before any step uses them.