Forum Discussion

abeirne's avatar
abeirne
Icon for Helper II rankHelper II
4 years ago
Solved

Sorting usable customer emails from non-usable emails

Hi all, I have a large collection of customer emails, and I need to sort them from emails that are usable and those that are not. I have them all in one column, and I would like to search that column...
  • amitchandak's avatar
    amitchandak
    4 years ago

    abeirne , Sorry Syntax issue .

    correct one is

    if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0

     

     

    M test code

     

    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSnRITErWS87PVYrViVZKcUgB8vJSS8C85LIkMG1oZKwUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1],"@") and Text.Contains([Column1],".com") then 1 else 0)
    in
    #"Added Custom"