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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.