Forum Discussion

Fidzi8's avatar
Fidzi8
Helper V
5 years ago
Solved

Delate duplicate rows

Hi, I need advice. I have in PowerQuery duplicate rows by ID. I sort table by Name.1 and then dalete duplicate rows by ID. Then I see just sixth row but I need to see just first row.  ...
  • Greg_Deckler's avatar
    5 years ago

    Fidzi8 You need a Table.Buffer like this:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI0UIrVgTCNEExjCNMIocAIocAIqiAWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", Int64.Type}}),
        #"Sorted Rows" = Table.Sort(#"Changed Type",{{"Column2", Order.Descending}}),
        Buffer = Table.Buffer(#"Sorted Rows"),
        #"Removed Duplicates" = Table.Distinct(Buffer, {"Column1"})
    in
        #"Removed Duplicates"