Power BI Power Query: How To Write IF Statement

Welcome to Excel Jet Blog Post. In this tutorial, we want to learn how to write nested IF statement in Power BI Power Query. Let’s get started

In the caption above, we will create a custom column. In the custom column, Customer Type Platinum, Gold, Silver and Bronze receives 10%, 8%, 5% and 2% discount multiplied by respective Total

In the General group of the Add Column tab, click on Custom Column

In the Custom Column dialogue box, provide Discount as the column name and execute the formula in the column formula

=if [Customer Type]=”Platinum” then [Total]*0.10 else if [Customer Type]=”Gold” then [Total]*0.08 else if [Customer Type]=”Silver” then [Total]*0.05 else [Total]*0.02

From the caption above, we can see that open and close parenthesis are not required in the Power Query. Also, we noticed that we have the green pass mark below telling us that there is no errors detected in our long if statement formula

Click OK

From the caption above, we can the Discount custom column with the correct values based on the if statement

Posted in Blog.

Leave a Reply

Your email address will not be published. Required fields are marked *