Forum Discussion

CoreyP's avatar
CoreyP
Solution Sage
6 years ago
Solved

M 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...
  • v-lionel-msft's avatar
    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 Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.