How to Add Applied Steps in Power BI
The "Applied Steps" pane in Power BI's Power Query Editor is your secret weapon for creating clean, reliable, and easy-to-understand data models. It meticulously records every transformation you make, creating a repeatable roadmap from your raw data to your final table. This article will show you exactly how to work with, customize, and manage these applied steps to build efficient and transparent data queries.
What Are 'Applied Steps' in Power BI?
Think of the Applied Steps pane as a recipe for your data. Every time you clean, shape, or transform your data in the Power Query Editor - like removing a column, filtering rows, or changing a data type - that action is automatically recorded as a distinct "step" in a list. You can find this pane on the right-hand side of the Power Query Editor window.
This sequential log is incredibly powerful for several reasons:
- Transparency: Anyone (including your future self) can open the query and see the exact journey the data took, step by step.
- Debugging: If an error pops up after a data refresh, you can click through each step to pinpoint exactly where things went wrong.
- Repeatability: Every time you refresh your data, Power BI re-applies these same steps in the same order, ensuring your transformations are consistent.
- Flexibility: You can edit, reorder, or delete steps at any time to adjust your data cleaning process without starting over from scratch.
It's the feature that elevates Power Query from a simple data importer to a robust data transformation engine.
How Power Query Automatically Adds Steps
You don’t have to do anything special to start using Applied Steps, Power Query does it for you. Let's walk through a common scenario. Imagine you're connecting to an Excel file containing sales data.
As soon as you connect to the file and select a worksheet, Power Query gets to work and automatically generates the first few steps:
- Source: This is the very first step. It records the connection to your original data source, whether it's an Excel file, a database, or a web page.
- Navigation: This step logs which specific table or sheet you selected from that source.
- Promoted Headers: Power Query often recognizes that the first row of your data is actually column headers and automatically promotes them. This action is recorded here.
- Changed Type: Next, Power Query scans each column and makes an educated guess about the data type (e.g., Whole Number, Text, Date). It applies these formats in this step.
Now, let's say you perform a few manual cleaning actions:
- You remove a "Notes" column that you don't need for your analysis. A new step named "Removed Columns" appears.
- You filter the "Country" column to only show "USA." A new step named "Filtered Rows" is added.
- You notice some entries are "US" instead of "USA" and use the "Replace Values" feature to standardize them. A step called "Replaced Value" appears.
With each click, your transformation list grows, creating a clear history of your work. Clicking on any step in the list will show you what the data looked like at that specific point in the process, which is fantastic for troubleshooting.
How to Manually Add a Custom Step
Button clicks are great, but sometimes you need to perform actions that aren't available in the user interface. This is where manually adding a step using Power Query's M language comes in handy. It gives you ultimate control over your data transformations.
The easiest way to add a custom step is using the fx button in the formula bar.
Here’s how to do it:
- Make sure you have the Formula Bar visible. If not, go to the View tab in the Power Query Editor and check the box for "Formula Bar."
- In the Applied Steps pane, select the last step in your list. This ensures your new step builds on the most recent version of your data.
- Click the fx icon to the left of the formula bar.
Power Query will immediately insert a new step, typically named "Custom 1." The formula bar will show the code for this new step, which simply references the previous step's name, like so:
= #"Filtered Rows"This code does nothing yet - it just takes the output of the previous step and passes it along. To make it do something useful, you need to wrap it in a function from the M language.
Example: Adding a Conditional "Sales Category" Column
Let's say we want to add a new column that categorizes sales as "Large" if they are over $1,000 and "Small" otherwise. While you could use the "Conditional Column" button, doing it as a custom step demonstrates the process perfectly.
- Add a new custom step using the fx button as described above.
- Select the new "Custom 1" step.
- In the formula bar, replace the existing code with the following M formula:
= Table.AddColumn(#"Replaced Value", "Sales Category", each if [SaleAmount] > 1000 then "Large" else "Small", type text)Let's break this down:
Table.AddColumn(...): This is the M function to add a new column.#"Replaced Value": This is the name of our previous step. We are telling Power Query to perform this action on the table that resulted from the "Replaced Value" step. This is the crucial link."Sales Category": This is the name for our new column.each if [SaleAmount] > 1000 then "Large" else "Small": This is the logic. For each row (each), it checks the value in theSaleAmountcolumn and returns the corresponding text.type text: This last part assigns the 'Text' data type to our new column.
Once you hit Enter, you’ll see your new "Sales Category" column appear, and your custom step is logged. You can now rename this step to something more descriptive, like "Added Sales Category Column."
Managing and Organizing Your Applied Steps
As your queries get more complex, your list of applied steps will grow. Keeping it organized is essential for maintaining your report.
Rename Steps for Clarity
Power Query's default names ("Replaced Value", "Filtered Rows 1") are functional but not descriptive. If you replace values in three different columns, you'll end up with steps that are hard to distinguish.
Right-click any step and choose "Rename."
Change your step names to describe the business logic or intent:
- "Replaced Value" becomes "Standardize Country Codes to ISO".
- "Filtered Rows" becomes "Remove Test Accounts".
- "Added Custom" becomes "Calculate Gross Margin".
This simple habit makes your work infinitely easier for others (and yourself) to understand months later.
Reorder and Delete Steps Carefully
You can manage your steps dynamically:
- To delete a step, simply click the X icon next to its name.
- To reorder steps, you can drag and drop them in the list.
Warning: Be very careful when changing the order. Each step often depends on the one before it. If you move a step that references a column before that column has been created, your query will break. Reordering is safest when the steps are independent of each other (for example, removing Column A and removing Column B can be done in any order).
Go Deeper with the Advanced Editor
To see the master script behind all your applied steps, go to the Home tab and click on Advanced Editor. This opens a window showing the complete M code for your entire query. Each step you created is listed sequentially as a variable in the script. This view is excellent for advanced troubleshooting, copying entire query logic, or adding manual comments to your code.
Best Practices for Applied Steps
To keep your queries efficient and maintainable, follow these simple rules:
- Filter and Remove Early: Remove any unneeded columns and filter out unnecessary rows as early as possible in your steps. This reduces the amount of memory Power BI uses and can significantly speed up processing and data refresh times.
- Rename Everything: A well-named set of steps is the best documentation you can create. Don't skip this.
- Avoid Overly Complex Custom Steps: If a single custom step is becoming incredibly long and complex, consider breaking it down into several smaller, more manageable steps. This will make it easier to debug later.
- Use Comments in the Advanced Editor: For particularly tricky M code that isn't self-explanatory, add comments to explain your logic. A single-line comment starts with
//, while a multi-line comment is enclosed in/* ... */.
Final Thoughts
Mastering the Applied Steps pane in Power BI transforms data cleaning from a confusing chore into a clear, methodical process. By understanding how steps are automatically added, learning to insert your own custom logic, and keeping everything well-organized, you build a resilient and transparent data foundation for your reports.
While this level of manual control is a hallmark of traditional BI tools, the entire process of stepping through transformations can be automated. With a tool like Graphed , we skip the need for you to manually clean, join, and structure data. Simply connect your sources, describe the analysis or report you need in plain English, and our AI builds the interactive dashboards for you in real time - handling all the necessary data transformation behind the scenes.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.