# Maintain and debug Power Query applied steps and M transformations Trace step dependencies, edit the smallest step, assign explicit types and find the first failing step instead of patching the final error. - Canonical: https://satracking.net/guides/power-query-applied-steps-dependency-debugging/ - Language: en - Category: platforms - Level: intermediate - Published: 2026-11-14 - Updated: 2026-11-14 --- ## Why applied-step discipline matters Trace step dependencies, edit the smallest step, assign explicit types and find the first failing step instead of patching the final error. A later step often depends on a column name, type or structure created by an earlier step. Editing an early step can therefore break several later steps even when the edit itself appears valid. The source tutorial describes the Power Query Editor, the Applied Steps list, editing a step through the formula bar, deleting one step or deleting subsequent steps, and reviewing the complete M expression in Advanced Editor. This guide turns those operations into a safe maintenance method. ## 1. Give queries and steps meaningful names Rename a query so that its purpose is clear, rather than retaining a generic name copied from the source table. Use step names that describe the transformation, such as: - `Source` - `Promoted Headers` - `Filtered Valid Rows` - `Changed Column Types` - `Split Product Code` - `Merged Customer Lookup` Avoid names such as `Step1`, `Changed Type1` or `Custom2` when a clearer description is possible. Names are part of the maintenance interface: they help another analyst understand the pipeline without opening every formula. ## 2. Understand the dependency chain Think of each applied step as a function of the previous result. For example: ```powerquery let Source = Excel.CurrentWorkbook(){[Name="SalesInput"]}[Content], PromotedHeaders = Table.PromoteHeaders(Source), FilteredRows = Table.SelectRows(PromotedHeaders, each [Status] = "Complete"), ChangedTypes = Table.TransformColumnTypes( FilteredRows, {{"OrderDate", type date}, {"Amount", Currency.Type}} ) in ChangedTypes ``` This illustrative query shows the dependency order: `PromotedHeaders` expects the source result, `FilteredRows` expects a `Status` column, and `ChangedTypes` expects `OrderDate` and `Amount`. If an earlier rename changes `OrderDate` to `Date`, the final type step can fail. Before editing, identify which later steps reference the affected field or step. ## 3. Edit the smallest possible unit When a transformation is wrong, select its step in Applied Steps and inspect the formula bar. Make the smallest change that corrects the intended behavior. After editing, check the preview immediately and then inspect every downstream step. If a change invalidates later steps, do not repeatedly patch errors without understanding the dependency. You may need to: - update later references to the renamed field; - move the transformation to a more appropriate point; - delete and recreate downstream steps; - restore the original step and choose a safer approach. The tutorial describes deleting a selected step and deleting subsequent steps. Use a delete-until-end operation only when you understand that all later transformations will be removed and are prepared to rebuild them. ## 4. Treat data types as part of the model contract The source material emphasizes explicitly assigning data types. A numeric amount, identifier, date and Boolean flag should not be left to unreliable inference. Typical Power Query types include whole number, decimal number, fixed decimal/currency, date, time, date/time, duration, text and true/false. Select the type based on meaning: - identifiers with leading zeros are often text, not numbers; - currency values need a deliberate precision and rounding policy; - date strings need a known locale and format; - flags should be Boolean only when values are consistently true/false; - durations should not be confused with clock times. Type conversion can fail when a column contains mixed formats or invalid values. Inspect errors rather than replacing every conversion failure with zero or null. ## 5. Use the formula bar and Advanced Editor appropriately The formula bar is useful for changing the expression of one selected step. Advanced Editor shows the complete M query and is more appropriate when reviewing the overall sequence, shared expressions or complex dependencies. M is case-sensitive and uses a `let ... in` structure. Step names containing spaces require quoted identifier syntax. When editing M: - preserve commas between bindings; - ensure each step name is unique; - verify references use the exact step and field names; - keep the final `in` expression pointed at the intended output; - test the query after each logical change. Do not paste code from an unrelated query without adapting source names, column names and data types. ## 6. Debug the first failing step, not just the final error When the final query shows an error, select Applied Steps from top to bottom until you find the first step that fails or produces an unexpected preview. This narrows the problem to the transformation where the assumption stopped being true. For each failure, record: - the failing step name; - the error message; - the relevant input column or value; - whether the issue is a missing field, type conversion, malformed value or changed source schema; - the corrective change and its impact on later steps. A later error may be a consequence, not the root cause. Fixing the first broken assumption is more reliable than changing the final step blindly. ## 7. Keep transformations reproducible Avoid manual corrections in the loaded worksheet after the query runs. Such edits are not part of the transformation pipeline and may disappear or become inconsistent on refresh. Put repeatable cleaning rules into Power Query, and document exceptions that require human review. Before distributing the workbook or report, refresh from the original source and confirm: - expected columns and types; - row counts before and after filters; - key totals; - no unexpected error rows; - output location and load settings. ## Troubleshooting patterns **A renamed column breaks later steps:** search the downstream expressions for the old name and update the dependency consistently. **A step works on the sample but fails on refresh:** inspect new source files for missing columns, changed types or unexpected values. **Numbers are interpreted incorrectly:** check locale, decimal separator and type conversion order. **A deleted step causes many errors:** restore from version control or undo where possible; otherwise recreate the required transformations in dependency order. **The preview is correct but the loaded result is stale:** verify the query's load destination and refresh status. ## Maintenance checklist Use descriptive query and step names, understand the dependency chain, edit the smallest possible step, explicitly assign types, validate the first failing step and refresh from the original source before release. The Applied Steps list is not merely a history of clicks; it is executable transformation logic that should be maintained like code. ## Official references - Microsoft Power Tools for Data Analysis #03: Power Query Introduction — Transform & Load Data in Excel & Power BI — https://learn.microsoft.com/power-query/ (verified 2026-11-14)