Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

uzuntasgokberk

Power BI Conditional Column Tutorial:No Custom Column Needed

Introduction

 

Have you ever needed to categorize or flag your data in Power BI based on some condition, but you weren’t sure how to do it without writing code? You’re in the right place. In this post, I will show you how to use Power BI Custom Column and Conditional Column feature to implement with Power Query. This tutorial is perfect for Power BI beginners. With advantages of you can achieve powerful results in Power BI without custom column coding or any M formulas.

 

Many newcomers think they need to write an IF statement manually in the Power Query Custom Column dialog to create conditional logic. However, Power BI provides a no-code alternative called Conditional Column that handles the logic for you. I’ll walk you through the process step by step, mirroring the approach I demonstrated in my video. By the end, you’ll be comfortable adding conditional columns using only the Power Query Editor’s built-in dialog, making this a handy Power BI tutorial for beginners and experienced users alike.

 

Why Use a Conditional Column (No Custom Code Required)


The Conditional Column dialog in Power BI is a user-friendly way to create new columns based on conditions, without writing any M code by hand. This means you don’t have to worry about the syntax of Power Query formulas or learn a new programming language. Here are a few reasons why using the Conditional Column feature is advantageous:

 

  • No Coding Necessary: You can define rules using dropdowns and input fields. The interface generates the underlying formula for you, so Power Query conditional logic is implemented behind the scenes. This is great if you’re not comfortable with coding or want to save time.
  • Fewer Errors: Because you’re using a guided dialog, you’re less likely to make syntax mistakes. The tool ensures your IF-THEN-ELSE logic is valid. No missing commas, no typos — it’s all handled for you.
  • Multiple Conditions Made Easy: The dialog allows you to add multiple “else if” clauses with a click of a button. Nesting several conditions manually can be tricky, but the Conditional Column tool makes it straightforward to build complex logic (for example, checking various ranges or categories) one step at a time.
  • Beginner-Friendly: If you’re following a Power BI tutorial for beginners, this approach is much more approachable than writing formulas from scratch. It leverages a point and click experience similar to building formulas in Excel, making the transition to Power BI smoother.
  • Consistent and Readable: The finished logic is easy to read when you revisit it. Each condition is clearly separated in the dialog. If someone else is reading your Power Query steps (or if you come back later), the intent of the conditional column is clear without deciphering code.

In short, the Conditional Column feature empowers you to implement powerful logic in your data transformations with just a few clicks. Now, let’s dive into how to actually create a conditional column step by step.

 

Step-by-Step: How to Add a Custom Column in Power BI

  • Let’s walk through an example of creating a custom column first in Power BI. In this scenario, imagine we have a Products table that features just three core fields Product, Sales, and Date making it perfect for illustrating custom column and conditional-column techniques in a clean dataset.

uzuntasgokberk_1-1748635001244.png

  • Although this tutorial unfolds inside a PowerBI/Fabric dataflow, you can replicate every step in Power BI Desktop as well: simply click Transform Data to launch Power Query, load the same Products table, and follow along.

uzuntasgokberk_2-1748635172442.png

 

  • Go to Add Column Ribbon: Once the Power Query Editor is open with your data query, look at the top ribbon. Click on the Add Column tab. This is where you can add new custom column.
  • Select Custom Column: In the Add Column ribbon, find and click the Custom Column button. This will open the Add Custom Column dialog box. This is the key feature that lets us specify with coding.

uzuntasgokberk_3-1748635193722.png

  • Add Custom Raw Code: We want to classify each sales as “High,” “Medium,” or “Low” based on the sales amount. We’ll do this using with raw code. Our goal is to label each sale as Low when it is under 100, Medium when it is under 200 and High otherwise and type the M formula in one line: if [Sales] < 100 then “Low” else if [Sales] < 200 then “Medium” else “High”. Pressing OK yields the correct result but also reminds you that M is case-sensitive and a stray character breaks the step.

uzuntasgokberk_4-1748635235063.png

 

  • After we add the Custom Column, Power Query immediately renders the logic: the new field shows the outcome of every IF test alongside the source data, and the formula bar exposes the exact M language expression we wrote and perfect proof that the code-driven approach is working as intended inside Power BI.

uzuntasgokberk_5-1748635319615.png

  • In the Query Settings pane you can inspect every transformation Power Query applied, and here’s the interesting part even though we hand-typed raw M code in the Custom Column dialog, the step now shows up as Added Custom with the same icon Power BI uses for a Conditional Column. That visual cue reminds you that, under the hood, both approaches generate identical logic.

uzuntasgokberk_6-1748635344162.png


Step-by-Step: How to Add a Conditional Column in Power BI


Ready to see how effortlessly you can build logic in Power BI without ever opening the Custom Column dialog? In this hands-on walkthrough, we’ll create a Conditional Column, no M code, no typing using the intuitive Conditional Column feature in Power Query Editor. Just follow the steps below and watch how quickly you can classify your data with a few clicks:

 

  • Go to Add Column Ribbon: Once the Power Query Editor is open with your data query, look at the top ribbon. Click on the Add Column tab. This is where you can add new computed columns to your dataset.
  • Select Conditional Column: In the Add Column ribbon, find and click the Conditional Column button. This will open the Add Conditional Column dialog box. This is the key feature that lets us specify our conditions without any coding.

uzuntasgokberk_7-1748635372181.png

 

  • Name the New Column: At the top of the dialog, there’s a field for New column name. By default, Power BI might fill in “Custom” as a placeholder name. Click that and type a descriptive name for your new column. For our example, let’s call it Sales Conditional.
  • Define the First Condition: Now you’ll specify the logic. You’ll see fields labeled Column Name, Operator, Value, and Output. For the first condition, set these as follows: choose the column on which you want to base the condition from the Column Name dropdown (e.g. SalesAmount), then choose an Operator (for example, is less than), and enter a Value (say 100). This condition reads like a sentence: “If SalesAmount is less than 100”. In the Output box, enter what the result should be when the condition is true in our case, type Low.
  • Add an Else If (Additional Condition): We want to categorize Medium and High as well. Click the Add Clause (sometimes shown as an “Add rule” or Add button) to add another condition line. A new set of fields appears for the next condition. Set up this second condition, for example: Column Name = SalesAmount, Operator = is less than, Value = 200. In the Output for this clause, enter Medium. This reads: “Else if SalesAmount is less than 200, then Medium.”
  • Specify the Final Else (Catch-all): The Conditional Column dialog usually provides a default Else part for any values that don’t match your listed conditions. You can set this final Output value in the dialog’s bottom section. By default, it might say “else none” or have a default value. Click on it and type High as the output for all other cases. This covers any sales that are 201 or higher in our example. (If you don’t see a separate field for the final else, it might be that the last clause you added serves as the “else”. Just ensure you have covered all desired conditions. The dialog won’t let any case go uncategorized.)
  • Confirm and Create the Column: Double-check your conditions for accuracy. The dialog should now read something like:

If SalesAmount is less than 100 then Low; Else if SalesAmount is less than 200 then Medium; Otherwise (Else) High. Once everything looks good, click OK. Power BI will close the dialog and add a new column to your table based on the rules you specified.

uzuntasgokberk_8-1748635390898.png


Apply Changes: If everything looks correct, go ahead and click Close & Apply (in Power BI Desktop) to load this transformed data back into your Power BI report. The new conditional column will now be part of your data model, and you can use it in visuals, just like any other field.

uzuntasgokberk_9-1748635420287.png


(Optional) Inspect the Formula: This step isn’t required, but it’s insightful. Power Query has automatically written an M formula for your conditional logic. If you’re curious, you can see it by clicking the Advanced Editor or by looking at the Applied Steps pane. You’ll find a step labeled something like “Added Conditional Column”. Clicking the gear icon next to that step re-opens the Conditional Column dialog. If you switch to the Formula Bar view, you’ll see an M expression that starts with = Table.AddColumn(…) and contains an each if … then … else … structure. The best part is you didn’t have to write any of that yourself! Power BI handled the syntax while you provided the logic through the dialog.

 

With those steps, you’ve successfully created a conditional column using only the point-and-click interface. This method can be adapted to many scenarios — checking text values (e.g., if a column contains a certain word), dates (e.g., if a date is before/after a given cutoff), blanks, and so on. Next, let’s highlight why this approach can be more advantageous than writing custom formulas directly.

 

Advantages of Using the Conditional Column Dialog over Custom M Code


By now, you’ve seen how straightforward it is to add a conditional column through the Power Query Editor UI. To reinforce why this no-code method is often better, especially for those new to Power BI, let’s summarize its key advantages:

 

  • Saves Time and Effort: Writing M code for an if/then/else by hand in a Custom Column requires knowledge of the syntax (for example, the correct placement of then and else, case sensitivity, etc.). The Conditional Column dialog spares you from this, speeding up development. You can build logic in seconds that might take much longer to script and debug manually.
  • Avoids Learning a New Formula Language: Power Query uses the M language for custom formulas, which is different from Excel formulas and also not the same as DAX (used elsewhere in Power BI). For beginners who might already be overwhelmed, skipping the need to learn M right away is a huge plus.
  • Reduces Errors and Complexity: When you write nested IF statements by hand, it’s easy to make a mistake in logic or syntax. The dialog method structures the logic clearly. Each condition is separate and can be re-ordered or edited without hunting through a formula string.
  • Rich Comparison Operators Built-in: The Conditional Column feature includes various operators like “equals”, “does not equal”, “is less than”, “is greater than or equal to”, and even text-specific ones like “contains”, “begins with”, etc.
  • Immediate Feedback: As you build the conditional column, you can see the new column populate in the data preview. This immediate feedback loop lets you verify that your logic is doing what you expect.
  • Great for Quick Prototyping: Even if you eventually plan to write more advanced transformations, the Conditional Column dialog is a fast way to prototype your logic.


In summary, using the Conditional Column dialog is faster, safer, and more accessible, especially for those who are new to Power BI or not inclined to code. It leverages the power of Power Query in a very approachable way.

 

Conclusion


In this tutorial, we learned how to build a Conditional Column in Power BI without ever touching the Custom Column dialog or writing code. You saw how the Power Query Editor provides a friendly interface to set up conditional logic (IF statements) through a few clicks, making it simple to create new categorized columns from your data. This no-code approach is a huge time-saver and lowers the barrier for beginners to implement powerful data transformations.

 

Comments