How to Add a Column in Transform Data in Power BI
Adding a new column to your data in Power BI is a fundamental step in turning raw numbers into meaningful insights. The Transform Data window, known as the Power Query editor, is your workshop for shaping, cleaning, and enriching your data before it ever hits your dashboard. This article breaks down the three primary ways to add columns in Power Query so you can prepare your data for analysis with confidence.
Why Add Columns in Power Query (and not with DAX)
Before jumping into the "how," it's helpful to understand the "why." You can add columns in Power BI in two places: in the Power Query editor (using the M language) or in the report view after your data is loaded (using DAX). While both have their place, creating columns during the data transformation stage in Power Query is often the better choice for data preparation.
Here’s why:
- Better Performance: When you add a column in Power Query, the calculation happens once during the data refresh. The new column is then physically stored in your data model. Columns created with DAX, on the other hand, are often calculated on-the-fly and can consume more processing power, potentially slowing down your reports, especially with large datasets.
- Cleaner Workflow: Power Query is designed for data preparation. Keeping all your transformations - including creating new foundational columns - in one place makes your workflow more organized and easier to troubleshoot. Let Power Query handle the data structure, and let DAX handle the dynamic analysis on top of that clean structure.
- Simplicity for Row-Level Logic: For straightforward row-by-row calculations (like multiplying a price by a quantity), the tools in Power Query are incredibly intuitive and require less complex syntax than their DAX equivalents.
Your Starting Point: The Power Query Editor
All the magic happens inside Power BI's Power Query editor. Getting there is simple. From the main Power BI Desktop screen:
- On the Home ribbon, click Transform data.
This action opens a new window, the Power Query Editor. This is where you’ll manage your data sources, apply transformations, and add new columns to your tables before they are loaded into your Power BI model. Any changes you make here are recorded as steps in the "Applied Steps" pane on the right, creating a repeatable process for every time your data is refreshed.
Method 1: Using "Custom Column" for Formula-Based Calculations
The "Custom Column" feature is your most versatile tool. It allows you to write a formula using Power Query's M language to create a new column based on existing data. This is perfect for mathematical operations, text combinations, date logic, and much more.
Let's walk through a common business example. Imagine you have a sales table with columns for UnitPrice, Quantity, and a SalesTax percentage. Your goal is to create a new FinalPrice column that includes the tax.
Step-by-Step Instructions:
- Navigate to the "Add Column" Tab: With your table selected in the Power Query editor, click on the Add Column tab in the ribbon.
- Open the Custom Column tool: Click on Custom Column. This opens the formula editor.
- Name Your New Column: In the "New column name" field, type "FinalPrice". This name should be descriptive and easy for you and others to understand.
- Write the Formula: In the "Custom column formula" box, you will define the calculation. You can type column names directly or, to avoid typos, select them from the "Available columns" list on the right and click Insert. Our formula to calculate the final price is:
- Create the Column: Click OK. Power Query adds the new
FinalPricecolumn to the end of your table, performing the calculation for every single row. - Set the Data Type (Crucial Final Step!): Power BI often defaults new custom columns to an "Any" data type. This can cause problems later. Click the icon on the new column header (it might look like "ABC 123") and select the correct data type, such as Decimal Number or Fixed decimal number (for currency).
Custom Column is your go-to whenever you need full control and your logic can be expressed in a formula.
Method 2: Creating a "Conditional Column" with Business Logic
What if your new column isn’t based on a mathematical formula but on business rules? This is where the "Conditional Column" feature shines. It provides a simple, menu-driven interface for creating if-then-else logic without writing a single line of code.
Let’s expand on our sales data. Suppose your company wants to categorize sales into "Small Order" and "Large Order" based on the quantity sold. The rule is: if more than 5 items are sold, it’s a "Large Order", otherwise, it’s a "Small Order".
Step-by-Step Instructions:
- Select "Conditional Column": In the Add Column tab, click Conditional Column. This brings up a user-friendly configuration window.
- Name the New Column: Enter "OrderSize" in the "New column name" field.
- Build Your Logic: Now, you'll translate your business rule into Power Query's fields:
- Set the Default Value: The Else field is the catch-all for any rows that don't meet the "If" condition. In this field, type "Small Order".
- Add More Conditions (Optional): If you had more complex logic (e.g., Small, Medium, Large), you could click the "Add clause" button to add more "Else If" statements. For our example, the single "If...Else" is enough.
- Create the Column: Click OK. Power Query instantly adds the
OrderSizecolumn, categorizing every sale in your dataset according to your rules. Since the output is text, the data type is correctly set automatically.
Method 3: Let Power BI Do the Work with "Column from Examples"
This is arguably one of the most powerful and beginner-friendly features in the Power Query editor. "Column from Examples" uses AI to figure out the transformation you want based on sample output you provide. For instance, if you want a column with a full name formatted as "Lastname, Firstname," instead of tinkering with text manipulation formulas, you just show it what you want.
Step-by-Step Instructions:
- Select Your Base Columns: This isn't required, but it really helps Power BI narrow down the possibilities. Click on the
FirstNamecolumn header, then hold down Ctrl and click theLastNamecolumn header. - Activate "Column From Examples": Go to the Add Column tab and click Column from Examples. A new, editable column named "Column1" will appear on the far right of your table.
- Provide Your First Example: Double-click the first empty cell in this new column. For a row that says "John" and "Smith," type your desired output:
Smith, John. Press Enter. - Review the AI's Suggestion: Based on that single example, Power BI will attempt to fill in the rest of the column. It even shows you the M formula it generated at the top! In this case, it will likely get it right on the first try.
- Provide a Second Example (If Needed): If the suggestions are not quite right, scroll down to a row where the pattern is incorrect and provide another corrected example. Power BI will instantly refine its logic based on the new information you've provided.
- Confirm and Create: Once you're satisfied with the preview, click OK. Power BI adds your new column using the formula it derived from your examples. Don't forget to rename the column (by double-clicking the header) to something descriptive like "FullName".
Choosing the Right Method for Your Needs
With three great options, how do you pick the right one? Here's a simple guide:
- Use Custom Column for: Any situation requiring a mathematical or date/time calculation. It's the most flexible option when you know the exact M formula required. It gives you complete control over the logic.
- Use Conditional Column for: Segmenting or categorizing your data based on layers of if-then-else rules. This method replaces complex nested "if" statements with a simple, code-free user interface.
- Use Column from Examples for: Complex text formatting, splitting, merging, or extracting information. When you are not sure what the exact formula is to combine parts from a few other columns and add some custom text in between, this is your fastest route by far.
Final Thoughts
Mastering how to add columns in the Transform Data editor is a critical skill for any Power BI developer. By using Custom Columns for formulas, Conditional Columns for logic, and Column From Examples for pattern recognition, you can efficiently prepare clean, robust data models ready for visualization and reporting.
Ultimately, the goal of data preparation is to get to the answers faster. While tools like Power BI are powerful, their complexity can become a bottleneck to the very insights you’re after. At our company, we designed Graphed because we believe anyone on your team should be able to get answers from their data without a steep learning curve. We connect your marketing and sales sources in one place, and then you use simple, plain English to create dashboards and ask questions, cutting down your reporting time from hours to seconds.
Related Articles
How to Connect Facebook to Google Data Studio: The Complete Guide for 2026
Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.
Appsflyer vs Mixpanel: Complete 2026 Comparison Guide
The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.
DashThis vs AgencyAnalytics: The Ultimate Comparison Guide for Marketing Agencies
When it comes to choosing the right marketing reporting platform, agencies often find themselves torn between two industry leaders: DashThis and AgencyAnalytics. Both platforms promise to streamline reporting, save time, and impress clients with stunning visualizations. But which one truly delivers on these promises?