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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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