Power Query – Power Pivot Overview
Module 5: Power Pivot Overview
Objective
Learn how to load data into the Data Model, build relationships, and use DAX measures in PivotTables.
Files Used
Enabling Power Pivot
Steps:
- In Excel, click the File tab in the top left corner.
- Select Options from the bottom of the left menu.
- In the Excel Options window, select Add-ins.
- At the bottom, in the Manage dropdown, choose COM Add-ins.
- Click the Go... button next to it.
- In the COM Add-Ins window, check the box next to Microsoft Power Pivot for Excel.
- Click OK.
- The Power Pivot tab should now be visible in the Excel ribbon.
Loading Data to Power Pivot
Steps:
- In Excel, go to the Data tab → click Get Data → choose From Workbook.
- Select the file PowerPivot_SalesData.xlsx.
- In the Navigator pane, select the relevant sheet(s) and click Transform Data.
- In Power Query Editor, verify the data is clean. Then click the dropdown next to Close & Load → choose Close & Load To....
- In the Import Data dialog:
- Select Only Create Connection
- Check the box for Add this data to the Data Model
- Click OK.
- The data is now loaded into the Power Pivot model, not into a worksheet.
Opening the Power Pivot Window
Steps:
- Click the Power Pivot tab on the Excel ribbon.
- Click the Manage button.
- The Power Pivot window will open in a new window, showing your data.
Creating Relationships
Steps:
- In the Power Pivot window, go to the top ribbon and click on Diagram View.
- You'll see a visual layout of all tables in your model.
- If there are multiple tables, you can click and drag a field (e.g., `ProductID`) from one table to a matching field in another (e.g., `ProductID` in Sales and Products).
- Alternatively, go to the Design tab → click Create Relationship.
- In the dialog, select the two tables and matching columns.
- Click OK.
Creating a DAX Measure
Steps:
- In the Power Pivot window, ensure you're in the Data View.
- Scroll to the bottom of the data table (below the columns) where you'll see a cell labeled Add Measure or an empty row.
- Click in that row and type the formula:
Total Revenue := SUM([Revenue])
- Press Enter.
- The measure will now appear in the Fields list and can be used in PivotTables.
Using Power Pivot in PivotTables
Steps:
- In Excel, go to the Insert tab.
- Click on PivotTable.
- In the Create PivotTable dialog:
- Select the option: Use this workbook’s Data Model.
- Choose where you want the PivotTable to be placed (new worksheet or existing one).
- Click OK.
- In the PivotTable Fields pane, you'll see your Power Pivot tables.
- Drag fields into Rows, Columns, and Values as needed.
Additional Exercise: Create PivotTable with DAX Measure
Goal: Analyze revenue by region.
Steps:
- Follow the steps to insert a PivotTable based on the Data Model.
- In the PivotTable Fields pane:
- Drag `Region` into the Rows area.
- Drag the DAX measure `Total Revenue` into the Values area.
- Click any cell in the PivotTable → right-click → choose Sort → Sort Largest to Smallest.
Extension: Add Calculated Column
Goal: Add a column that estimates margin as 25% of revenue.
Steps:
- In the Power Pivot window → go to the table where you want the column.
- Scroll to the rightmost column → click into the empty column labeled Add Column.
- Type the formula:
=[Revenue] * 0.25
- Press Enter.
- Power Pivot will automatically name the column (you can rename it to `EstimatedMargin`).
- Return to Excel and create a new PivotTable using this field as needed.
→ Continue to Module 6: Summary and Final Exercises
Return to Main Page