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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Super User
Super User

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 ""

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
Super User
Super User

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

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