Joining multiple SQL databases in Power Query

masplin

Active Member
Joined
May 10, 2010
Messages
413
I'm brand new to Power Query, but been using Powerpivot for a while. i'm looking to convert all my PP SQL queries into Power query so that I can use the cool paramaterisation some kind people explained to me.

My main query combines 5 different tables using the following SQL

Code:
SELECT        Reporting_Transactions_Fact.Location, Reporting_Transactions_Fact.TransID, Reporting_BusDates.BusDate,              Reporting_Plus_Fact.LineNum, Reporting_Plus_Fact.PluNo, Reporting_Plus_Fact.Qty, Reporting_Plus_Fact.TotalValue , 
               Reporting_Transactions_Fact.SaleTotal,
                      Reporting_Plus_Fact.ClerkID, Reporting_Terminals.EcrID, Reporting_Plus_Fact.AdjustmentsValue, 
                      Reporting_Plus_Fact.TaxNonAddValue, Reporting_Plus_Fact.SeatingArea, Reporting_Times.Hour, Reporting_Times.Minute                          
FROM            Reporting_Terminals INNER JOIN
                         Reporting_Plus_Fact ON Reporting_Terminals.EcrID = Reporting_Plus_Fact.EcrID INNER JOIN
                         Reporting_BusDates ON Reporting_Plus_Fact.BusDateID = Reporting_BusDates.BusDateID INNER JOIN
                         Reporting_Transactions_Fact ON Reporting_Plus_Fact.TransID = Reporting_Transactions_Fact.TransID  INNER JOIN
                         Reporting_Times ON Reporting_Plus_Fact.TimeID = Reporting_Times.TimeID 




WHERE        Reporting_Plus_Fact.CorrectionType = 0 AND Reporting_Transactions_Fact.SalesMode = 0 AND Reporting_Transactions_Fact.SalesType = 0 AND
              Reporting_BusDates.BusDate < '2016-01-01'  AND Reporting_BusDates.BusDate >'2015-07-31' 
                        AND  Reporting_Transactions_Fact.Location >0000

So I guess I need to convert this into "M", but i have even less clue about that than I do SQL!


  1. Is there any straight forward way to convert SQL to M?
  2. Assuming not I loaded up the 5 tables in PQ and set about merging them using the join function. This created 2 new questions
  3. I joined the first 2 tables together , but one has 10mio rows so took forever to do the join. Should I filter down the first table to something manageable and then remove the filters once all 5 tables are joined?
  4. After the first join completed I see the columns of the first table with a new column "table". What do I click on next to join the 3rd table? Do I click on the table that contains the other join field or on this new "Table"?
Thanks for any advice
Mike
 
Found it. Schoolboy error and manged to duplicate the joins when I was unsure what i was doing. Time now 1 min so even got an improvement.
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top