Forum Discussion
Anonymous
2 years agoNot applicable
Difference between Table1 and Table2
I have a 2 tables, both has the same column names col1, col2. Table1 has more data (1000) and Table2 has subset of Table1 (300). I am trying to get the rows into another table which are exists only i...
- 2 years ago
Merge the tables and use an Anti-join. It's all done in the Merge dialog
- Anonymous2 years agoBelow is the script. Had to remove a 3rd column which is being created.
letSource1 = Table1,Source2 = Table2,DistinctTable1 = Table.Distinct(Table.SelectColumns(Source1, {"col1", "col2"})),DistinctTable2 = Table.Distinct(Table.SelectColumns(Source2, {"col1", "col2"})),Difference = Table.NestedJoin(DistinctTable1, {"col1"}, DistinctTable2, {"col1"}, "DistinctTable2", JoinKind.LeftAnti)#"Removed Columns" = Table.RemoveColumns(Difference,{"DistinctTable2"}),inDifference
Anonymous
2 years agoNot applicable
Below is the script. Had to remove a 3rd column which is being created.
let
let
Source1 = Table1,
Source2 = Table2,
DistinctTable1 = Table.Distinct(Table.SelectColumns(Source1, {"col1", "col2"})),
DistinctTable2 = Table.Distinct(Table.SelectColumns(Source2, {"col1", "col2"})),
Difference = Table.NestedJoin(DistinctTable1, {"col1"}, DistinctTable2, {"col1"}, "DistinctTable2", JoinKind.LeftAnti)
#"Removed Columns" = Table.RemoveColumns(Difference,{"DistinctTable2"}),
in
Difference