Forum Discussion
CoreyP
Solution Sage
6 years agoM Query Editor - Trouble with Conditional IF statement
Hey guys, I have a dataset that is a transaction log of pallet movements within a warehouse. It has the following fields: Date, Pallet No., From Location, To Location. I am adding a conditional c...
- 6 years ago
Hi CoreyP ,
"The logic should read: If From Location starts with REP and To Location starts with PAS or PUT, then Repack Entry. "
Try this code:
if Text.StartsWith([FROM_LOCATION], "REP") and ( Text.StartsWith([TO_LOCATION], "PAS") or Text.StartsWith([TO_LOCATION], "PUT") ) then "Repack Entry" else null)Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MartynRamsden
Solution Sage
6 years agoHi CoreyP
Looks like your 'Repack' IF statement is simply missing a set of parentheses.
Try this:
if
Text.StartsWith([FROM_LOCATION], "REP")
and (Text.StartsWith([TO_LOCATION], "PAS")
or Text.StartsWith([TO_LOCATION], "PUT"))
then "Repack Entry"
else
Best regards,
Martyn