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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PowerBINoob12
Helper I
Helper I

If statement with a not equals in it

Hi All,

 

I've created a new column and im trying to add the below logic to it:

if "fruit" equals "Bananna" and "colour" does not equal "yellow" then "unripe"

I've tried both ways below but they dont work as it wont compare the string in both cases

IF([Fruit] = "Bananna" && NOT([Color]) = "Yellow", "Unripe",  

IF([Fruit] = "Bananna" && ([Colour]) <> "Yellow", "Unripe",  

All values are strings

Any help would be appreciated.

1 ACCEPTED SOLUTION

The start of your formula was already correct. The full formula would be;

 

IF([Fruit] = "Bananna" && NOT([Color]) IN { "Yellow", "Unripe" }), 

View solution in original post

3 REPLIES 3
ce87
Helper I
Helper I

Hi @PowerBINoob12 ,

This can be accomplished with NOT and IN

 

NOT([Color]) IN { "Yellow", "Unripe" }), 

 

 

 

I need both parts of the if statement though - It also needs to check if fruit = bananna

The start of your formula was already correct. The full formula would be;

 

IF([Fruit] = "Bananna" && NOT([Color]) IN { "Yellow", "Unripe" }), 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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