Add 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

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

Please click the Edit Queries option under the Home tab.

Edit Queries Option 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.

Add Conditional Column in Power BI 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 Column Name, Operator, Value, and Output Statement

As shown in the screenshot below, we added two more rules. 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 9

From the screenshot below, you can see the new col with the information that we specified in the step before. 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