Skip to main content

The Power BI Conditional column generates a new column based on the condition we specify, for example, creating an evaluation column based on employee performance, etc. Let me show you how to add a conditional column in Power BI with an example.

How to add a conditional column in Power BI

To demonstrate this conditional column from Power BI, we will use the SQL table that we imported in the Enter data article.

To add a conditional column, click the Edit queries option under the Home tongue.

add-conditional-column-in-power-bi-1-9942885

By clicking on the Edit queries The option opens a new window called Power BI Power Query Editor. In this example, we will use the Sales column.

add-conditional-column-in-power-bi-2-1899707

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

add-conditional-column-in-power-bi-3-1337500

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

add-conditional-column-in-power-bi-4-1315453

We change the name of the column to Classification. Next, we select the column name as Sales

add-conditional-column-in-power-bi-5-1237711

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

add-conditional-column-in-power-bi-6-9320038

We added the first rule: if sales are over 3000, return Excellent within the grade column. Then click the Add Rule button to add a new rule.

add-conditional-column-in-power-bi-7-7183949

As you can see in the screenshot below, we added two more rules. Remember, this is the same as the Else If statement in SQL.

add-conditional-column-in-power-bi-8-9502455

You can use the… .. button to move the selected rule up and down, or you can also delete it. For now, we leave it as is and click the OK button

add-conditional-column-in-power-bi-9-8726213

From the screenshot below, you can see the new column with the information we specified in the conditional column. Then press the Close and apply option under the Home tab to apply these changes.

add-conditional-column-in-power-bi-10-2184906

You can now see the new Power BI conditional column named Grade in the SQL Employees table.

add-conditional-column-in-power-bi-11-6254136
error: Attention: Protected content.