Forum Discussion
screamout_93
2 years agoFrequent Visitor
Remove duplicate row for two multiple columns and condition on the third column
Hi guys, I need help on the power query . My intention here is to remove the duplicate value for line and date . what i want is to make it so the query will only remove rows that has null value in [F...
- 2 years ago
Hello, screamout_93
let Source = your_table, #"Grouped Rows" = Table.Group(Source, {"Date", "Line"}, {{"Count", each Table.RowCount(_), Int64.Type}, {"rows", each _, type table [Date=datetime, Line=number, From=any]}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "new_rows", each if [Count] > 1 then Table.SelectRows([rows], (x) => x[From] <> "Null") else [rows]), result = Table.Combine(#"Added Custom"[new_rows]) in result
AlienSx
2 years agoSuper User
Hello, screamout_93
let
Source = your_table,
#"Grouped Rows" = Table.Group(Source, {"Date", "Line"}, {{"Count", each Table.RowCount(_), Int64.Type}, {"rows", each _, type table [Date=datetime, Line=number, From=any]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "new_rows", each if [Count] > 1 then Table.SelectRows([rows], (x) => x[From] <> "Null") else [rows]),
result = Table.Combine(#"Added Custom"[new_rows])
in
result- screamout_932 years agoFrequent Visitor
Thank you! your a lifesaver.