Forum Discussion

HALEYSTODDARD's avatar
HALEYSTODDARD
Frequent Visitor
4 years ago
Solved

Power Query - customer column if statement with list.contains and wildcard?

Hello All,   I'm still fairly new to Power BI, but I'm essentially trying to create a customer column to filter out customer's comments and flag them as a tracking issue.    so for example, out o...
  • Anonymous's avatar
    Anonymous
    4 years ago

    HALEYSTODDARD 

     

    It is literally working, your initial thought. Split your original column to a list, then transform to lower case, so you don't need all kinds of Fedex, compare the searchList and your original column. Paste the M code in Advanced Editor via Blank query, you will see the steps

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WqqioUHBLTUmtUKgEAoUqIFCK1YGIp+EQLylKTM7GJZ6Zl44sFQsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
        searchList={"fedex","track","tracking"},
        #"Added Custom" = Table.AddColumn(Source, "Custom", each if List.Intersect({ List.Transform( Text.Split([Column1]," "), Text.Lower), searchList}) ={}then"valid issue" else "transportation issue" )
    in
        #"Added Custom"