Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Clean column containing inconsistent data entered people

Hi,   I have a table of meetings and a column with topics. These topics are entered by the person conducting the meeting and aren't always standarized, but do contain a keyword. I read you can use ...
  • Jimmy801's avatar
    Jimmy801
    5 years ago

    Hello Anonymous 

     

    you can use Table.FuzzyNestedJoin. Use the joinOptions to define treshold and other options to change the outcome. However you didn't specify that all content is always replaced with the value of the to-column or you need a replacement. If the second is the case you could use both of your column from and to to search for the "from" and replace it with the "to"

    Here to code

    let
        Topic = let
            Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXKOUHBNSU9VitWJVjIC8uEcYyDHsag0KVHBOSc1sSggsbgYLG4C0oQQiQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Meeting Id" = _t, Column1 = _t]),
            #"Changed Type" = Table.TransformColumnTypes(Source,{{"Meeting Id", Int64.Type}, {"Column1", type text}})
        in
            #"Changed Type",
    Transformation = let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wck1JT1XSUXL0D9Z1jtB1dXF3VYrViVZyzklNLApILC4GyiHYsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [From = _t, To = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"From", type text}, {"To", type text}})
    in
        #"Changed Type",
    
    JoinFuzzy = Table.FuzzyNestedJoin
    (
        Topic,
        "Column1",
        Transformation,
        "From",
        "New",
        JoinKind.LeftOuter,
        [Threshold=0.5, IgnoreCase=true]
    ),
        #"Expanded New" = Table.ExpandTableColumn(JoinFuzzy, "New", {"To"}, {"To"})
    in
        #"Expanded New"

    THis is the output


    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy