Forum Discussion
Anonymous
3 years agoNot applicable
remove duplicates based on values in 2 columns
Hello there, I've got 2 tables: table 1 contains sales data based on a key which is product-volume combination. sales are captured on this key table 2 is my item master table, I can have several ...
- 3 years ago
Hi Anonymous
I am not sure that I understood your goal completely,
It sounds like you need a group by your data, with aggregation by maximum code, if it is on separate columns you can concatenate them before the grouping.
Tutorial to concatenating columns:
https://excelchamps.com/power-query/concatenate/Group by here:
https://learn.microsoft.com/en-us/power-query/group-byIf this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- 3 years ago
pls try this
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxK1jXQM1fSUTI0MDAEUXpGpkqxOqgyRgY4ZIzMTOAysQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"product-size" = _t, #"item code" = _t, price = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"product-size", type text}, {"item code", Int64.Type}, {"price", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"product-size"}, {{"Count", (x)=>Table.SelectRows(x, each [item code]=List.Max(x[item code]))}}), #"Removed Other Columns" = Table.SelectColumns(#"Grouped Rows",{"Count"}), #"Expanded Count" = Table.ExpandTableColumn(#"Removed Other Columns", "Count", {"product-size", "item code", "price"}, {"product-size", "item code", "price"}) in #"Expanded Count"
Anonymous
2 years agoNot applicable
looks like you did understand what I was looking for. all good now. thanks