Power bi conditional column example

In this Power BI blog, we will discuss how to add a conditional column in Power BI desktop.

The conditional column is a new custom column that will display the output based on the condition satisfied in Power BI.

For example, I have a SharePoint list of “10thGradeSheet2019” which is having some of the students result. We will see how to add the conditional column so that the custom column will display the grade value.

How to Connect SharePoint List Data Source to Power BI Desktop?

First I have created a SharePoint Online List of the name “10thGradeSheet2019“. Using Power BI desktop we will add a conditional custom column where we are going to use the “Marks” column.

power bi conditional column
power bi connect to sharepoint list

Open the Power BI desktop in the local system. Pass the Office 365 credentials if asked. By default, the Home tab is selected. Click on the Get Data->More.

power bi conditional column multiple values
connect powerbi to sharepoint list

Click on “Online Service” in the “Get Data” page. Select the SharePoint Online List and click on “Connect”.

power bi conditional column if and
power bi connect to sharepoint list

Pass the SharePoint site URL where the list is present. Click on OK.

power bi conditional column if statement
power bi connect to sharepoint list

Select the List Name as “10thGradeSheet2019” and Click on “Load”.

power bi conditional column blank
power bi connect to sharepoint list

Read How to use Power bi switch function

Add the Conditional Column in Power BI Desktop

On the top of the Power BI desktop, we will get “Edit Queries”->Edit Queries.

power bi add conditional column blank
conditional column in power bi

It will navigate to a ” Power Query Editor Page”. The Page will look like the below screenshot.

conditional column in power bi
conditional column in power bi

In the “Power Query Editor Page” select on “Add Column”->”Conditional Colum”.

conditional column in power bi
conditional column in power bi

The Conditional Column option will display a new window of “Add Conditional Column” where we will add the rule.

power bi conditional column contains
power bi custom column if statement

Inside the “New column name” we need to pass the custom calculated column name. In the Column Name dropdown list, I have selected the column name as “Marks(%)”.

Select the condition from the Operator dropdown list. When we are expanding the Value field “ABC” we will get “Enter a value”, “Select a column”. That means we can enter the value manually or we can select the column.

Here I have entered manually 90. In the Output, I have entered “Outstanding”. From the Add rule box, we can add more rules.

power bi conditional column contains
add multiple conditions in power bi

I have added 5 more rules. It is the same as if and else if condition. In the if condition added some of the rules and in else I have added Fail manually. When the above 6 conditions will not satisfy then the else part will execute. Click on OK.

power bi conditional column between values
power bi custom column if statement

Each condition we can move up and down. We can also Delete the condition in the Add Conditional Column.

conditional column in power bi
add multiple condition in power bi

Now we will see our custom conditional column have added.

add conditional column in power bi
power bi conditional column multiple conditions

Go to the Report page. We will get the Custom Conditional column under the SharePoint list name. I have added a Table Visualization and in the Values, fields added all the column name which we want to display

create conditional column in power bi
add multiple conditions in power bi

You may like following Power BI tutorials:

This Power BI tutorial, we learned how to a conditional column in Power BI desktop.

>