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.
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.
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.
Clicking the Power BI Conditional Column button opens the following window.
We changed the name to Rating. Next, we selected the Column name Sales
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.
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.
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.
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.
Now you can see the new Power BI Conditional Column called rating under the SQL Employees table.