Power BI Conditional column generate a new column based on the condition that we specify. For example, creating an appraisal column based on the employee performance etc. In this article will show you, How to add Conditional Column in Power BI with example.
How to add Conditional Column in Power BI
To demonstrate this Conditional Column, we are going to use the SQL table that we imported in Enter Data article.
In order to add conditional column, please click Edit Queries option under the Home tab.
Clicking Edit Queries option will open a new window called Power Query Editor. In this example, we are going to use the Sales column.
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 column on this table.
Clicking the Conditional Column button will open the following window.
We changed the Column name as Rating. Next, we selected the Column name as Sales
Next, we selected the Operator as greater than, and value as 3000. Within the Values or Output text box, either you can give the static values or you can select the column.
We added the first Rule – If Sales is greater than 3000 then return Excellent inside the rating Column. Next, click Add rule button to add new rule
You can use the ….. button to move selected Rule to up and down, or you can delete it as well. For now, we are leaving as it is, and click OK button
From the below screenshot, you can see the new column with the information that we specified in the conditional column. Next, hit Close & Apply option under the Home tab to apply these changes.
Now you can see the new column called rating under the SQL Employees table