none
Remove Duplicates with Different Word Order RRS feed

  • Question

  • Hi guys,

    this one is tough.

    We have 3 rows:

    1. Big blue bus

    2. Blue big bus

    3. Yellow nice car in garage.

    I want to remove either blue big bus or big blue bus because it is a duplicate but with different word order.

    Any tips?

    DZ


    Tuesday, April 26, 2016 3:36 PM

Answers

  • Hi Daniel,

    Try this code below.

    let Source = Table.FromColumns({{"Big blue bus","Blue big bus","Yellow nice car in garage"}}, {"Text"}), AddColumn = Table.AddColumn(Source, "Custom", each List.Sort(Text.Split(Text.Upper([Text]), " "),1)), RemoveDuplicates = Table.Distinct(AddColumn, {"Custom"}), RemoveColumn = Table.RemoveColumns(RemoveDuplicates,{"Custom"}) in RemoveColumn

    Regards

    • Marked as answer by Daniel Zrust Wednesday, April 27, 2016 8:00 AM
    Tuesday, April 26, 2016 4:48 PM

All replies

  • Hi Daniel,

    Try this code below.

    let Source = Table.FromColumns({{"Big blue bus","Blue big bus","Yellow nice car in garage"}}, {"Text"}), AddColumn = Table.AddColumn(Source, "Custom", each List.Sort(Text.Split(Text.Upper([Text]), " "),1)), RemoveDuplicates = Table.Distinct(AddColumn, {"Custom"}), RemoveColumn = Table.RemoveColumns(RemoveDuplicates,{"Custom"}) in RemoveColumn

    Regards

    • Marked as answer by Daniel Zrust Wednesday, April 27, 2016 8:00 AM
    Tuesday, April 26, 2016 4:48 PM
  • Awesome. Thanks!

    DZ

    Wednesday, April 27, 2016 8:00 AM