Forum Discussion
Anonymous
6 years agoNot applicable
Power query Remove Duplicates with two sorting tables
Hi, I have a problem with remove duplicates. I want to remove duplicates, but sorting should be on two tables: with one table it is working, but with two not. #"Removed Duplicates" = Table.Distin...
- 6 years ago
Hi Anonymous
You can use Group By and adjust the code like below.
let Source = Table, #"Grouped Rows" = Table.Group(Source, {"Case"}, {{"tbl", ( rows ) => let sort = Table.Sort( rows ,{{ "key 1", Order.Ascending}, {"Key 2", Order.Ascending}}), topRow = Table.FirstN( sort , 1) in topRow, type table [key 1=number, Key 2=number]}}), #"Expanded tbl" = Table.ExpandTableColumn(#"Grouped Rows", "tbl", {"key 1", "Key 2"}, {"key 1", "Key 2"}) in #"Expanded tbl"Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn
Mariusz
Community Champion
6 years agoHi Anonymous
You can use Group By and adjust the code like below.
let
Source = Table,
#"Grouped Rows" = Table.Group(Source, {"Case"}, {{"tbl",
( rows ) => let
sort = Table.Sort( rows ,{{ "key 1", Order.Ascending}, {"Key 2", Order.Ascending}}),
topRow = Table.FirstN( sort , 1)
in
topRow, type table [key 1=number, Key 2=number]}}),
#"Expanded tbl" = Table.ExpandTableColumn(#"Grouped Rows", "tbl", {"key 1", "Key 2"}, {"key 1", "Key 2"})
in
#"Expanded tbl"
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
LinkedIn
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.