Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
AnjaD
New Member

Can't make IF statement work in Power BI

I am trying to create a new column using an IF statement. If the column 'Survey Type' = AML Quantitative then return with the value in column 'Status'. In the status column there are various answers such as 'Completed', 'Not Started' or 'Compliance Review 4 in progress' etc. That is the value I would like to return. Below is the if statement with no syntax errors.

AnjaD_0-1696257816811.png

 

When hit 'Ok' it says: 'Expression.Error: The name 'IF' wasn't recognized. Make sure it's spelled correctly.' When I change IF to if I get the following message:

 

AnjaD_1-1696257997673.png

I remove the ) but it doesn't change anything. I am new to this so any help would be appreciated.

 

 

1 ACCEPTED SOLUTION
mlsx4
Memorable Member
Memorable Member

Hi @AnjaD 

 

In M, I think you need to use if conditional in this way:

 

IF <condition> then <ResultTrue> else <ReturnFalse>

So if I'm not wrong, you should write:

 

IF [Survey Type]="AML Quantitative" then [Status]

 

 

Anyway, taking into account the error given, the problem is you are missing a ")", so you need to add it, not to remove it

View solution in original post

4 REPLIES 4
AnjaD
New Member

@mlsx4 thank you very much. I figured it out. You saved my day!!

 

IF [Survey Type]="AML Quantitative" then [Status] else ""

mlsx4
Memorable Member
Memorable Member

You're welcome! I'm glad it works now

AnjaD
New Member

I tried that and now I get this error:

AnjaD_0-1696260970502.png

Not sure how to fix that.

mlsx4
Memorable Member
Memorable Member

Hi @AnjaD 

 

In M, I think you need to use if conditional in this way:

 

IF <condition> then <ResultTrue> else <ReturnFalse>

So if I'm not wrong, you should write:

 

IF [Survey Type]="AML Quantitative" then [Status]

 

 

Anyway, taking into account the error given, the problem is you are missing a ")", so you need to add it, not to remove it

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors