Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Problem with nested if and else with text.contains

Hi everyone,   I´ve a problem with my code in Power Query and I cant get my head around this.    My code below isn´t working and I dont know if it´s because of blank cells in the column or if the...
  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    4 years ago

    You can use following

    = Table.AddColumn(#"Replaced Value2", "GT", each try if [MarketingMedium] = "cpc" and [MarketingSource]= "google" and not Text.Contains([MarketingCampaign], "brand") then 1 else if ([MarketingMedium] = "cpc" or [MarketingMedium] = "referral") and [MarketingSource]= "bing" and Text.Contains([MarketingCampaign], "yahoo") then 2 else 3 otherwise 3)