Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

"and" statement in M Language

Hi,

 

I am wanting to add a and statement into my conditional form.

 

 #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if Text.StartsWith([#"(Master) Campaign"], then "Remnant" else if Text.StartsWith([Advertiser], "House") then "House" else if Text.StartsWith([#"(Master) Campaign"], "1xl") then "National" else if Text.Contains([#"(Master) Campaign"], "COLUMBA") then "Local" else if Text.Contains([#"(Master) Campaign"], "BA ") then "BA" else if Text.Contains([#"(Master) Campaign"], "Amazon") then "Partnership" else if Text.Contains([#"(Master) Campaign"], "Teads") then "Partnership" else 

 

I am wanting to use a and statement and say something like

 

If Text.Contains([#"(Master) Campaign"], "House") and  Text.Contains([#"campaign"],"Open"), then "House Paid" 

then carry on with the else if

 

Any help appreciated.

 

Thanks

 

Chris

  • Anonymous's avatar
    Anonymous
    9 years ago

    Just to close this 

     

    yes you can use an and statement in M

     

    see

     

    If Text.Contains([#"(Master) Campaign"], "House") and  Text.Contains([#"campaign"],"Open"), then "House Open" 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Just to close this 

     

    yes you can use an and statement in M

     

    see

     

    If Text.Contains([#"(Master) Campaign"], "House") and  Text.Contains([#"campaign"],"Open"), then "House Open"