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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Andrey28
Regular Visitor

IF OR Statement

Hello,

 

I have a pretty simple question. I am using Query editor to add a Custom column to my table. This column is called "True cost" and adjusts costs based on the Warehouse code by a factor of 2.5. When I use one warehouse code everything works fine, when I add 2 or more the logic doesn't work. I don't receive a syntax error but when the query runs, a following message comes up "The name OR was not recognized". What am I doing wrong and how to correctly make IF OR statement ?

 

This formula works = if [Warehouse Code] ="XXX" then ([Total Transacted Cost]/2.5) else [Total Transacted Cost]

This formula doesn't =if [Warehouse Code] =OR("XXX", "YYY", "ZZZ") then ([Total Transacted Cost]/2.5) else [Total Transacted Cost]

 

Thanks,

Andrey

1 ACCEPTED SOLUTION

Thanks. Looks like it worked. I just need to repeat each time [Warehouse Code] = before "or".

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Try this M code

=if [Warehouse Code] = "XXX" or "YYY" or "ZZZ" then [Total Transacted Cost]/2.5 else [Total Transacted Cost]

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks. Looks like it worked. I just need to repeat each time [Warehouse Code] = before "or".

Yes, i missed that.  You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.