none
Possible to merge (join) queries in Power Query without creating tables first? RRS feed

  • Question

  • Hello,

    I'm new to Power Query and am learning how to use the 'Merge Queries' functionality in Power Query in order to join 2 tables to produce a new result set.  It seems that I have to create 2 Power Query-created queries and then join the resulting tables created from those queries.  Is there a way within Power Query to simply join 2 already-existing data ranges within the Excel workbook instead of having to create separate tables beforehand?  I'm trying to avoid having to create existing data ranges a second time when I'd like to join those ranges in a separate Power Query.

    Is this possible?

    Thank you!

    Tuesday, September 27, 2016 2:43 PM

Answers

  • Hi Pat. You can do this by writing some custom M to directly reference the Excel ranges/tables without first creating separate queries for them in PQ. Values you'll need to tweak for your specific scenario are in bold.

    = Table.NestedJoin(Excel.CurrentWorkbook(){[Name="Table1"]}[Content], {"Column1"}, Excel.CurrentWorkbook(){[Name="Table2"]}[Content], {"Column1"}, "NewColumn", JoinKind.LeftOuter)

    Ehren

    Wednesday, September 28, 2016 5:16 PM
    Owner
  • It's possible to do this, but you may as well create two queries and merge these - you don't have to actually load the results of the two queries, instead you can use only the definition (or connection, as Power Query calls it).
    Wednesday, September 28, 2016 6:42 PM

All replies

  • Hi Pat. You can do this by writing some custom M to directly reference the Excel ranges/tables without first creating separate queries for them in PQ. Values you'll need to tweak for your specific scenario are in bold.

    = Table.NestedJoin(Excel.CurrentWorkbook(){[Name="Table1"]}[Content], {"Column1"}, Excel.CurrentWorkbook(){[Name="Table2"]}[Content], {"Column1"}, "NewColumn", JoinKind.LeftOuter)

    Ehren

    Wednesday, September 28, 2016 5:16 PM
    Owner
  • It's possible to do this, but you may as well create two queries and merge these - you don't have to actually load the results of the two queries, instead you can use only the definition (or connection, as Power Query calls it).
    Wednesday, September 28, 2016 6:42 PM