Locked lesson.
About this lesson
Let's continue our look at Power Pivot and how to combine multiple data sources.
Exercise files
Download this lesson’s related exercise files.
06-05-Combine Data Sources with PowerPivot-Part2-Start.xlsx241.8 KB 06-05-Combine Data Sources with PowerPivot-Part2-Complete.xlsx
363.2 KB Transaction_Analysis.xlsx
254.6 KB Exercise - Combine Multiple Data Sources - Part2.xlsx
422 KB 6.05 combine-multiple-data-sources-with-power-pivot-part2 - Exercise.docx
52.7 KB Exercise Solution - Combine Multiple Data Sources - Part2.xlsx
437.2 KB 6.05 combine-multiple-data-sources-with-power-pivot-part2 - Exercise solution .docx
135.6 KB
Quick reference
Combine Multiple Data Sources with Power Pivot and Power Query
Learn how to create a PivotTable that uses data from multiple sources.
When to use
We create a PivotTable using Power Pivot and Power Query whenever we have data stored in different sources.
Instructions
Combine with Other Files
Now we have our combined transaction files loaded into Excel, we also want to combine with two more tables of data, 'Accounts' and 'Products' that are stored in the 'Transaction_Analysis.xlsx' workbook.
- Click in the Transaction_Data table.
- Go to the Power Pivot tab.
- Click Add to Data Model.
The transaction data will now show in a tab in the Power Pivot window and we can bring in other tables of data.
- From the Home tab, in the Get External Data group, click From Other Sources.
- Scroll down and choose Excel File.
- Click Next.
- Click Browse.
- Select the 'Transaction_Analysis.xlsx' file.
- Select both tables, 'Products' and 'Accounts'.
- Click Finish.
- Click Close.
Create a Consolidated PivotTable
Now we have all tables added to the data model, we can create a consolidated Pivot Table.
- From the Home tab (Power Pivot), click the drop-down under PivotTable.
- Click PivotTable.
- Select New Worksheet.
A blank PivotTable report will be created in Excel. The PivotTable Fields pane will show all tables and fields.
In theory, we should be able to use any field from any table to build our PivotTable report.
- Drag the Products field from the Products table into Rows.
- Drag the Amount field from Transaction_Data into Values.
Notice that the values in the Sum of Amount column are wrong. Also, notice the yellow warning message.
We are getting these issues because the tables are not linked. In order for Excel to calculate correctly, all tables need to have a relationship.
We create relationships between tables using a common field. If tables do not share a common field, we can create a link table that uses a field from one table and a field from another.
That is outside the scope of this course, but it's worth bearing in mind.
Create Relationships Between Tables
Tables can only be linked by a common field.
- From the Power Pivot tab (in Excel), in the Data Model group, click Manage.
- From the Home tab (in Power Pivot), in the View group, click Diagram view.
Currently, our tables are not linked together.
- Drag the AcctNo field from the Accounts table and drop it onto the AcctNo field in the Transaction_Data table.
- Drag the ProdNo field from the Products table and drop it onto the ProdNo field in the Transaction_Data table.
When we go back to Excel, the PivotTable can now calculate correctly.
Login to downloadLesson notes are only available for subscribers.