Forum Discussion
ngct1112
4 years agoPost Patron
PowerQuery - Remove Duplicated lines based on criteria
Hi all, I would like to remove lines with duplicated "ID" and keep the lowest "price" line. May I know if there any quick way(not using groupby) I could do for this case? Original Table ID Pric...
- 4 years ago
Easier way, add sorted rows, buffer and remove duplicate step
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI0UIrVgTDNwSwnIMsSzjI0UoqNBQA=", 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", type text}, {"Column2", Int64.Type}}), #"Sorted Rows" = Table.Sort(#"Changed Type",{{"Column2", Order.Ascending}}), #"Buffered" = Table.Buffer(#"Sorted Rows"), #"Removed Duplicates" = Table.Distinct(Buffered, {"Column1"}) in #"Removed Duplicates"