Power Query – Power Pivot Overview: Difference between revisions

From Training Material
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:


== Objective ==
== Objective ==
In this module, you’ll get an introduction to Power Pivot and learn how to build a basic data model from Power Query output.
Learn how to load multiple related tables into the Data Model using Power Query, create relationships in Power Pivot, and build PivotTables using DAX calculations.


== Files Used ==
== Files Used ==
* [[Media:PowerPivot_SalesData.xlsx|Download PowerPivot_SalesData.xlsx]]
* [[Media:PowerPivot_Customers.xlsx|Download PowerPivot_Customers.xlsx]]
* [[Media:PowerPivot_Products.xlsx|Download PowerPivot_Products.xlsx]]
* [[Media:PowerPivot_Sales.xlsx|Download PowerPivot_Sales.xlsx]]


== What is Power Pivot? ==
== Enabling Power Pivot Add-in ==
Power Pivot is an Excel add-in that allows you to build relationships between tables and perform advanced data analysis using the Data Model.
'''Steps:'''
# Open Excel.
# Go to the '''File''' tab → click '''Options'''.
# In the Excel Options window → select '''Add-ins'''.
# At the bottom, next to '''Manage''', select '''COM Add-ins''' from the dropdown → click '''Go...'''.
# In the list, check '''Microsoft Power Pivot for Excel''' → click '''OK'''.
# The '''Power Pivot''' tab will now appear in the ribbon.


It works seamlessly with Power Query by allowing you to load cleaned and transformed data directly into the Data Model.
== Importing Data via Power Query into the Data Model ==
'''Steps:'''
# Go to the '''Data''' tab → click '''Get Data''' → '''From File''' → '''From Workbook'''.
# Select and open '''PowerPivot_Customers.xlsx'''.
# In Navigator → check the sheet → click '''Transform Data'''.
# In Power Query Editor → click the '''Home''' tab → click the dropdown under '''Close & Load''' → choose '''Close & Load To...'''.
# In Import Data dialog:
#* Select '''Only Create Connection'''
#* Check the box '''Add this data to the Data Model'''
#* Click '''OK'''
# Repeat these steps for '''PowerPivot_Products.xlsx''' and '''PowerPivot_Sales.xlsx'''.


== Enabling Power Pivot ==
== Opening the Power Pivot Window ==
'''Steps:'''
'''Steps:'''
# In Excel, go to the '''File''' tab → '''Options'''
# Go to the Excel ribbon → click on the '''Power Pivot''' tab.
# Select '''Add-ins'''
# Click '''Manage'''.
# At the bottom, next to '''Manage''', choose '''COM Add-ins''' and click '''Go'''
# The Power Pivot window will open showing the loaded tables.
# Check '''Microsoft Power Pivot for Excel''' → Click '''OK'''
# You will now see a '''Power Pivot''' tab in the Excel ribbon


== Loading Data to Power Pivot ==
== Creating Relationships Between Tables ==
'''Steps:'''
'''Steps:'''
# Import the file '''PowerPivot_SalesData.xlsx''' via Power Query
# In the Power Pivot window → click the '''Diagram View''' button in the top-right.
# In the Power Query Editor, click '''Close & Load To...'''
# Drag from '''CustomerID''' in the Sales table to '''CustomerID''' in the Customers table.
# In the import dialog, select:
# Drag from '''ProductID''' in the Sales table to '''ProductID''' in the Products table.
#* '''Only Create Connection'''
# You should now see the relationships as arrows between the tables.
#* Check '''Add this data to the Data Model'''
# Click '''OK'''


== Opening the Power Pivot Window ==
== Creating a DAX Measure ==
'''Steps:'''
'''Steps:'''
# Go to the '''Power Pivot''' tab in Excel
# In the Power Pivot window → click on the '''Sales''' table.
# Click '''Manage'''
# Scroll to the bottom of the table.
# This opens a separate Power Pivot window showing the data model
# In the empty cell under the data → type the formula:


== Creating Relationships ==
  Total Sales := SUM([Total])
'''Steps:'''
# If you have multiple tables in the model, go to the '''Diagram View'''
# Drag fields from one table to another to create relationships (e.g. Customer ID → Customer ID)
# You can also go to the '''Design''' tab → '''Create Relationship'''


== Adding Measures (DAX) ==
# Press '''Enter'''.
You can create calculated fields (measures) using DAX (Data Analysis Expressions).
# The measure is now available in PivotTables.


== Building a PivotTable from the Data Model ==
'''Steps:'''
'''Steps:'''
# In the Power Pivot window, click into the bottom row of the table
# In Excel → go to the '''Insert''' tab → click '''PivotTable'''.
# Type a formula, e.g.:
# In Create PivotTable dialog:
<syntaxhighlight lang="dax">
#* Select '''Use this workbook’s Data Model'''
Total Revenue := SUM([Revenue])
#* Choose location (New worksheet or Existing worksheet)
</syntaxhighlight>
# Click '''OK'''
# Use fields from all related tables:
#* Add `Region` from Customers to Rows
#* Add `Category` from Products to Columns
#* Add `Total Sales` to Values


# Press Enter — the measure will appear in the model and can be used in PivotTables
== Extension: Add a Calculated Column in Power Pivot ==
'''Steps:'''
# In the Power Pivot window → select the '''Sales''' table.
# Scroll to the rightmost column → click into the empty column labeled '''Add Column'''.
# Type:


== Using Power Pivot in PivotTables ==
  =[Quantity] * 0.1
'''Steps:'''
# Go to Excel → Insert → PivotTable
# In the dialog, select '''Use this workbook’s Data Model'''
# Choose fields from your Power Pivot tables to build a PivotTable with relationships


----
# Press '''Enter'''.
# Rename the column to `EstimatedCommission`.


== Navigation ==


→ Continue to [[Power Query – Summary and Exercises|Module 6: Summary and Final Exercises]]
→ Continue to [[Power Query – Summary and Exercises|Module 6: Summary and Final Exercises]]


Return to [[Power_Query_–_Basic|Main Page]]
Return to [[Power_Query_–_Basic|Main Page]]

Latest revision as of 13:40, 22 June 2025

Module 5: Power Pivot Overview

Objective

Learn how to load multiple related tables into the Data Model using Power Query, create relationships in Power Pivot, and build PivotTables using DAX calculations.

Files Used

Enabling Power Pivot Add-in

Steps:

  1. Open Excel.
  2. Go to the File tab → click Options.
  3. In the Excel Options window → select Add-ins.
  4. At the bottom, next to Manage, select COM Add-ins from the dropdown → click Go....
  5. In the list, check Microsoft Power Pivot for Excel → click OK.
  6. The Power Pivot tab will now appear in the ribbon.

Importing Data via Power Query into the Data Model

Steps:

  1. Go to the Data tab → click Get DataFrom FileFrom Workbook.
  2. Select and open PowerPivot_Customers.xlsx.
  3. In Navigator → check the sheet → click Transform Data.
  4. In Power Query Editor → click the Home tab → click the dropdown under Close & Load → choose Close & Load To....
  5. In Import Data dialog:
    • Select Only Create Connection
    • Check the box Add this data to the Data Model
    • Click OK
  6. Repeat these steps for PowerPivot_Products.xlsx and PowerPivot_Sales.xlsx.

Opening the Power Pivot Window

Steps:

  1. Go to the Excel ribbon → click on the Power Pivot tab.
  2. Click Manage.
  3. The Power Pivot window will open showing the loaded tables.

Creating Relationships Between Tables

Steps:

  1. In the Power Pivot window → click the Diagram View button in the top-right.
  2. Drag from CustomerID in the Sales table to CustomerID in the Customers table.
  3. Drag from ProductID in the Sales table to ProductID in the Products table.
  4. You should now see the relationships as arrows between the tables.

Creating a DAX Measure

Steps:

  1. In the Power Pivot window → click on the Sales table.
  2. Scroll to the bottom of the table.
  3. In the empty cell under the data → type the formula:
 Total Sales := SUM([Total])
  1. Press Enter.
  2. The measure is now available in PivotTables.

Building a PivotTable from the Data Model

Steps:

  1. In Excel → go to the Insert tab → click PivotTable.
  2. In Create PivotTable dialog:
    • Select Use this workbook’s Data Model
    • Choose location (New worksheet or Existing worksheet)
  3. Click OK
  4. Use fields from all related tables:
    • Add `Region` from Customers to Rows
    • Add `Category` from Products to Columns
    • Add `Total Sales` to Values

Extension: Add a Calculated Column in Power Pivot

Steps:

  1. In the Power Pivot window → select the Sales table.
  2. Scroll to the rightmost column → click into the empty column labeled Add Column.
  3. Type:
 =[Quantity] * 0.1
  1. Press Enter.
  2. Rename the column to `EstimatedCommission`.

Navigation

→ Continue to Module 6: Summary and Final Exercises

Return to Main Page