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
SteveRudd
Helper I
Helper I

Using multiple IF or options

Hi All, 

 

I am trying to add a new column to take a "product" and add a "Category", there can be up to 10 product names in each category.

 

I wanted to use IF ([Product]= "option 1" or "option 2" or "option 3" etc , "Category 1", IF ([Product]= "option 6" or "option 7" or "option 8 " etc, "Category 2", IF ([Product] = "option 14" or "option 16" or "option 20" or "option 12", "Category 3", "no category")))

 

However this doesn't work, I'm sure there is a better way to achieve what I'm looking for, your help is greatly appreciated.

 

Thanks

 

Steve

 

1 ACCEPTED SOLUTION

Replace "or" with "||"

View solution in original post

8 REPLIES 8
tex628
Community Champion
Community Champion

 IF (
[Product] = "option 1" ||
[Product] = "option 2" || 
[Product] = "option 3"  , "Category 1", 
IF (
[Product] = "option 6" ||
[Product] = "option 7" ||
[Product] = "option 8 " , "Category 2", 
IF (
[Product] = "option 14" ||
[Product] = "option 16" ||
[Product] = "option 20" ||
[Product] = "option 12", "Category 3",
"no category")))

Connect on LinkedIn
ZunzunUOC
Resolver III
Resolver III

Could you show your raw data and your expected result?

This is what I see

 

error1.PNGproduct.PNG

Ok, in every OR you must use [Product]="VALUE". Try it please.

I still get an error, should I have additional parentheses?error2.PNG

Replace "or" with "||"

thats got it, thanks 🙂

 

This is right, &&= AND and ||=OR

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.

Top Solution Authors