The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Solved! Go to Solution.
Thanks. Looks like it worked. I just need to repeat each time [Warehouse Code] = before "or".
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.
Thanks. Looks like it worked. I just need to repeat each time [Warehouse Code] = before "or".
Yes, i missed that. You are welcome.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
79 | |
78 | |
47 | |
39 |
User | Count |
---|---|
147 | |
115 | |
65 | |
64 | |
53 |