Add a Conditional Column in Power BI

Power BI Conditional column generates a new column based on the condition that we specify — for example, creating an appraisal col based on employee performance, etc. Let me show you how to add a Conditional Column with an example.

How to add a Conditional Column in Power BI

We will use the SQL table we imported in the Enter Data article to demonstrate this Conditional Column.

Please click the Edit Queries option under the Home tab.

Edit Queries Option to Add Conditional Column in Power BI 1

Clicking the Edit Queries option opens a new Power BI Power Query Editor window. In this example, we are going to use the Sales col.

Available Fields in Edit Mode 2

First, go to Add Column Tab. Under this tab, you can see the Conditional Column button. You can use this button to add the conditional col to this table.

Add Conditional Column in Power BI 3

Clicking the Power BI Conditional Column button opens the following window.

Widow to choose operator, value, and output for the If statement 4

We changed the name to Rating. Next, we selected the Column name Sales

Choose the Column Name 5

Next, we chose the Operator as greater than and the value as 3000. Within the Values or Output text box, you can either give the static values or select the col.

Choose Either a static Value or Parameter 6

We added the first Rule – If Sales are greater than 3000, then return Excellent inside the rating. Next, click the Add Rule button to add a new rule.

Add New Rule as If Name, Operator, Value, and Output Statement

We added two more rules as shown in the Add Conditional Column in Power BI screenshot below. Remember, this is the same as the Else If Statement in SQL.

Add Few More Rules

You can use the ….. button to move the selected Rule up and down, or you can delete it as well. We are leaving it as it is and clicking the OK button.

Move Up, Move Down, and Delete Options to Add Conditional Column in Power BI 9

From the screenshot below, you can see the new col with the information we specified in the previous step. Next, hit the Close & Apply option under the Home tab to apply these changes.

Click the Apply Button 10

Now you can see the new Power BI Conditional Column called rating under the SQL Employees table.

View Conditional Column in Power BI 11