Search code examples
excelpowerbipowerquerypowerbi-desktopm

Replacing values based on condition in Power Query


I want to replace some acquaintance values by keywords to specific value, converting both "google" and "searching google" to "seo"

I tried replace but you should specify all the values to replace with and that's not possible. if there is a solution with "contain" function i think it would help but i couldn't find it.


Solution

  • enter image description here

    enter image description here

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Custom1 = Table.TransformColumns( Source, {{"Column1",(x)=> if Text.Contains(x, "google") then "seo" else x}})
    in
        Custom1