Forum Discussion
Jakez
3 years agoNew Member
How to join two tables which are non unique
Hi All, I have two tables as shown below and i want to merge them together to do some analysis in Powerbi, original source of the data is excel files. I want to join the table using two columns D...
- 3 years ago
- Disable "Auto Detect Relationship" under file settings.
- Before loading data make sure there are no existing relationships.
- You can join 2 table by using DealerID and Date as the Key
let Source = Table.NestedJoin ( Table1, { "Dealer_id", "Date" }, Table2, { "Dealer_id", "Date" }, "Table2", JoinKind.LeftOuter ), ExtractedSales = Table.ExpandTableColumn ( Source, "Table2", { " Sales" }, { " Sales" } ) in ExtractedSales
AntrikshSharma
Community Champion
3 years ago- Disable "Auto Detect Relationship" under file settings.
- Before loading data make sure there are no existing relationships.
- You can join 2 table by using DealerID and Date as the Key
let
Source =
Table.NestedJoin (
Table1,
{ "Dealer_id", "Date" },
Table2,
{ "Dealer_id", "Date" },
"Table2",
JoinKind.LeftOuter
),
ExtractedSales = Table.ExpandTableColumn ( Source, "Table2", { " Sales" }, { " Sales" } )
in
ExtractedSales
Dikshant
3 years agoNew Member
Works fine, Thanks Antriksh!
For the uninititated, you have to create a new Query to paste the above code in Advanced editor.
Also, remove the space before {" Sales"} to avoid error.