Conditional Column in Power Query Editor

In Power Query Editor, we can create the Conditional column in the Power BI.

With Power Query, we can create new columns whose values will be based on one or more conditions applied to other columns in our table. The Conditional column command is located on the Add column tab, in the General group.

Conditional Column in Power Query Editor

To add the conditional column, follow the following steps:
Step 1: By selecting Conditional column, a dialog box opens. In the Add conditional column dialog box, allows us to define the IF-THEN-ELSE conditions to display values for a given column.

Conditional Column in Power Query Editor

The dialog box has the following sections:
1. New column name: In this, we can define the name of our new conditional column.
2. Conditional clauses: Here we define our conditional clauses. We can add more clauses by selecting Add clause. Each conditional clause will be tested on the order shown in the dialog box, from top to bottom. Each clause has four parts:
• Column name: In the drop-down list, select the column to use for the conditional test.
• Operator: Select the type of test or operator for the conditional test.
• Value: We can enter a value or select a column to be used for the conditional test.
• Output: If the test is positive, the value entered here, or the column selected will be the output.
3. Final Else clause: If none of the clauses above yield a positive test, the output of this operation will be the one defined here, as a manually entered value or a value from a column.

Conditional Column in Power Query Editor

At the end of each clause, we can select the ellipsis button (...) to delete , move up, or move down the clause.

Conditional Column in Power Query Editor

We can see in the image below, our conditional column in created in the table.

Conditional Column in Power Query Editor