Forum Discussion

panipat1990's avatar
panipat1990
Helper III
8 years ago
Solved

Removing duplicate data

Dear Team,   Kindly Help me For Removing Duplicate Data.   Date Sale Art 01-04-2018 100 A 02-04-2018 200 B 03-04-2018 300 C 04-04-2018 400 D 05-04-2018 500 E 06-0...
  • ImkeF's avatar
    ImkeF
    8 years ago

    In the query editor, you add an index-column:

     

    Check the new index-column and sort descending:

     

    Edit the formula in the formula bar to this (otherwise the sort-order will not be kept):

     

     

    Check columns "Date" and "Art", and remove duplicates:

     

     

    This is the code that you can paste into the advanced editor to follow the steps along:

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Xc6xDcAgDETRXVyDZINBtCQhSyD2XyPWWXKR5opXnP7exJJZswxKJMy2k04yLsEFfDnX4Aq+nTVYwY9zC27g5dyDO/h1lt+JlZwP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t, Sale = _t, Art = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Sale", Int64.Type}, {"Art", type text}}),
        #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1),
        #"Sorted Rows" = Table.Buffer(Table.Sort(#"Added Index",{{"Index", Order.Descending}})),
        #"Removed Duplicates" = Table.Distinct(#"Sorted Rows", {"Date", "Art"})
    in
        #"Removed Duplicates"