In the Power Pivot window, on the Home tab, click the PivotTable button, leave New
4. In the Power Pivot window, on the Home tab, click the PivotTable button, leave New
Worksheet selected in the Create PivotTable dialog box and then click OK . You should see an empty PivotTable frame starting in cell B3 . On the right side of your Excel window, you should see the PivotTable Fields pane. Below the header in the PivotTable Fields pane, you should see ACTIVE and ALL tabs, and if ALL is selected, you should see all of the tables in the workbook listed and tblSalesData should appear in bold.
5. In the PivotTable Fields pane, click the little empty triangle to the left of tblSalesData to expand it and see the list of fields in the tblSalesData table. Select the check boxes for the Sales Amount field and the Units Sold field. You should see 654965187.3 in cell B4 and 25311934 in cell C4.
6. Right-click cell B4 and select Number Format from the shortcut menu. Select the Accounting format, set the Decimal places to 0 , and then click OK .
7. Right-click cell C4 and select Number Format . Select the Number format, set the Decimal places to 0 , check the box for Use 1000 separator (,) , and then click OK .
8. In the PivotTable Fields pane, check the box beside the State Abbr field to add it to ROWS area. It displays in the PivotTable as a ROW field.
9. Drag the Product field from the fields list to the COLUMNS area placing it above the ∑ Values field. Notice that after each type of product, we have one column for Sum of Sales Amount and another column for Sum of Units Sold.
10. Drag the ∑ Values field above the Product field. Note the change in the layout of the PivotTable. Now all of the Sum of Sales Amount columns are adjacent, followed by all of the Sum of Units Sold columns. Your PivotTable should look very similar to Figure 4-17.
Figure 4-17
A PivotTable created using Power Pivot
Working with Advanced Charts and PivotTables
11. SAVE the workbook. PAUSE. LEAVE the workbook open to use in the next exercise.
Managing Relationships in the Power Pivot Data Model The next exercise demonstrates where the benefits of the Power Pivot data model begin to shine.
Remember that before building our Power Pivot PivotTable, we looked at the data in our work- book, and changed the data sets into tables. Now we are going to add these tables to the model and define the relationships between the tables.
If you are not familiar with relational databases, a relationship is the term that describes when two tables have a connection between two fields. In our data model, our main sales data has the State Abbr column. All of the supporting tables also have a State Abbr column. This means that we can use the “NV” in the sales data table to look up who is the sales rep for Nevada. We can also look up which Sales Region Nevada is in, and we can look up the full name of the state that has the abbreviation “NV”.
If we are pulling data in from Access, Power Pivot will likely import any relationships between any tables that were defined in the Access database. But when using tables residing on Excel worksheets or importing data from a “flat file” like a .TXT or .CSV file, we need to define these relationships manually.
STEP BY STEP
Manage Relationships in Power Pivot
GET READY. USE the
04 Power Pivot Solution.xlsx workbook that should already be open in Excel 2016. All of the data blocks should now be defined as tables and the default names
changed to new names per a previous exercise.
1. Select the Rep by State worksheet in the main Excel application window. Select any cell in the tblRepByState table.
2. Click the Power Pivot tab. In the Tables group, click the Add to Data Model button.
3. Click back in the main Excel application window and repeat steps 1 and 2 for the
Region by State worksheet and the tblRegionByState table.