Excel® PowerPivot 2016
COPYRIGHT © 2017 Pathfinder Learning, LLP. All rights reserved. [email protected]
www.pathfinderlearning.com
End User License Agreement: This book or any portion thereof may not be reproduced or used in any manner
whatsoever without prior express written permission of the publisher. All brand names, product names, trademarks,
and registered trademarks are the property of their respective owners.
ISBN: 978-0-9908404-6-6
Excel® PowerPivot 2016 3
Table of Contents
About this Course 6
Target Student & Prerequisites ....................................................................................................6
How to Use this Book ..................................................................................................................6
Lesson 1: Introduction to PowerPivot 2016 7
Review PowerPivot 2016.............................................................................................................8
Exercise 1-1 Enable PowerPivot.............................................................................................9
Explore the PowerPivot Workspace............................................................................................10
Manage Data Model Button...................................................................................................10
Calculations Group ................................................................................................................10
Measures ...........................................................................................................................11
KPIs ..................................................................................................................................11
Tables ..................................................................................................................................... 11
Detect Relationships ..............................................................................................................12
Settings...................................................................................................................................12
Compare Excel® and PowerPivot...............................................................................................13
Lesson 2: Building Data Models 14
Review Data Models ...................................................................................................................15
Create Data Models.....................................................................................................................16
Manage Data Model...............................................................................................................16
Clipboard ..........................................................................................................................17
Get External Data .............................................................................................................17
Refresh .............................................................................................................................. 18
PivotTable.........................................................................................................................18
Formatting.........................................................................................................................18
Sort and Filter ...................................................................................................................19
Find ...................................................................................................................................19
Calculations ......................................................................................................................19
View..................................................................................................................................20
Exercise 2-1 Import Data from Access ..................................................................................25
Exercise 2-2 Import Data Using Copy and Paste...................................................................30
Exercise 2-3 Import Data Using a Text File ..........................................................................33
Exercise 2-4 Import Data Using an Excel® File ...................................................................36
Exercise 2-5 Explore the Manage Data Model Tab ...............................................................39
Exercise 2-6 Refresh the Data................................................................................................40
Lesson 3: Create a PivotTable and PivotChart 42
Determine Chart or Table............................................................................................................43
Create a PivotTable .....................................................................................................................44
PivotTable Fields ...................................................................................................................44
Exercise 3-1 Create Your First PivotTable ............................................................................46
Analyze ..................................................................................................................................50
PivotTable ..............................................................................................................................50
Active Field............................................................................................................................53
Group .....................................................................................................................................54
Filter.......................................................................................................................................54
Copyright ©2017 Pathfinder Learning, LLP
4 Excel PowerPivot 2016
Data ....................................................................................................................................... 54
Actions................................................................................................................................... 55
Calculations ........................................................................................................................... 55
Tools...................................................................................................................................... 57
Show...................................................................................................................................... 57
Exercise 3-2 Use the Analyze Tab to Change Your PivotTable ........................................... 58
Design.................................................................................................................................... 61
Layout.................................................................................................................................... 61
PivotTable Style Options....................................................................................................... 61
PivotTable Styles................................................................................................................... 62
Exercise 3-3 Use the Design Tab to Change your PivotTable .............................................. 63
Create a PivotChart..................................................................................................................... 64
PivotChart Fields ................................................................................................................... 64
Exercise 3-4 Create your First PivotChart............................................................................. 66
Analyze.................................................................................................................................. 67
PivotChart.............................................................................................................................. 67
Active Field ........................................................................................................................... 70
Filter ...................................................................................................................................... 71
Data ....................................................................................................................................... 71
Actions................................................................................................................................... 71
Calculations ........................................................................................................................... 72
Show/Hide ............................................................................................................................. 73
Exercise 3-5 Use the Analyze Tab to Change your PivotChart............................................. 74
Design.................................................................................................................................... 75
Chart Layouts ........................................................................................................................ 75
Chart Styles ........................................................................................................................... 75
Data ....................................................................................................................................... 76
Type....................................................................................................................................... 76
Location................................................................................................................................. 76
Exercise 3-6 Use the Design Tab to Change your PivotChart............................................... 77
Format ................................................................................................................................... 78
Current Selection ................................................................................................................... 78
Insert Shapes.......................................................................................................................... 78
Shape Styles........................................................................................................................... 79
WordArt Styles...................................................................................................................... 79
Arrange .................................................................................................................................. 80
Size ........................................................................................................................................ 81
Exercise 3-7 Use the Format Tab to Change your PivotChart .............................................. 82
Lesson 4: Use DAX in PowerPivot 83
Review DAX .............................................................................................................................. 84
DAX Operators...................................................................................................................... 84
Text Functions ....................................................................................................................... 85
Date and Time Functions....................................................................................................... 85
Logical Functions .................................................................................................................. 86
Statistical/Aggregation Functions.......................................................................................... 86
Informational Functions ........................................................................................................ 87
Math and Trigonometric Functions ....................................................................................... 87
Filter Functions...................................................................................................................... 87
Time Intelligence Functions .................................................................................................. 88
Context in DAX Formulas.......................................................................................................... 89
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 5
Define Calculated Columns ........................................................................................................89
Exercise 4-1 Create a Calculated Column with Data in the Same Table...............................90
Exercise 4-2 Create Calculated Columns with Data from Different Tables ..........................91
Define Measures (Calculated fields) ...........................................................................................93
Implicit Measure ....................................................................................................................93
Explicit Measure ....................................................................................................................93
Exercise 4-3 Create Measures................................................................................................95
Lesson 5: Enhance PivotTables & PivotCharts 98
Define Key Performance Indicators (KPIs) ................................................................................99
Exercise 5-1 Create a KPI and Use it in a PivotTable ..........................................................100
Define Slicers .............................................................................................................................101
Slicer Tools Options .............................................................................................................101
Exercise 5-2 Create Slicers ...................................................................................................104
Define Hierarchies .....................................................................................................................106
Exercise 5-3 Create Hierarchies............................................................................................107
Index 109
Glossary 110
Copyright ©2017 Pathfinder Learning, LLP
6 Excel PowerPivot 2016
About this Course
Target Student & Prerequisites
This course is for students with a good working knowledge of Microsoft® Excel 2016. Students should have
completed, or have experience with, topics covered in the Microsoft® Excel 2016 Introduction, Intermediate
and Advanced Training courses.
How to Use this Book
This book is designed to be used as part of an instructor led course. It contains various lessons that will guide
you through learning the course material. The topics are explained including definitions of terms and relevant
screen captures. Also included are exercises that will reinforce the material discussed. The exercises build on
each other.
Included with your book are files that you will need to complete the exercises. There are two high level
folders that are included. One labeled class files and the other labeled solution files. Each of these folders
includes a separate folder for each lesson. Place these folders on your desktop to make it easy to access the
files that are needed.
If for some reason, you are not able to complete each exercise, you can find files in each lesson folder to use
as your starting point for the exercises. In addition, there are solution files provided for each exercise. Make
sure that you save periodically so that you do not lose your work. In addition, you may need to click the
Enable Content button when using Excel.
At the end of the book, you will find a glossary of the definitions of terms used in this course. In addition
there is an index provided to allow you to quickly find what you are looking for.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 7
Lesson 1: Introduction to PowerPivot 2016
Unit time: 75 minutes
In this lesson, you will:
1 Review PowerPivot 2016
2 Explore the PowerPivot Workspace
3 Compare Excel® and PowerPivot
Copyright ©2017 Pathfinder Learning, LLP
8 Excel PowerPivot 2016
Review PowerPivot 2016
PowerPivot is a tool that is used to combine data from various sources into one PowerPivot database that is
part of an Excel® 2016 workbook. It allows you to integrate data from multiple sources and manipulate large
data sets easily. PowerPivot is an Excel® 2016 add-in you can use to perform powerful data analysis and
create sophisticated data models. PowerPivot comes pre-installed but disabled with Excel® 2016. It is
available in the Office Professional Plus, Office 365 Professional Plus® and in the stand-alone edition of
Excel® 2016.
PowerPivot is used to create self-service business intelligence (BI) reporting. Business intelligence is the
process of analyzing data and converting this analysis into knowledge. PowerPivot helps business users
access data in databases without extensive training and knowledge of data modeling.
The key to generating reports using PowerPivot is the data model. Data models can be created using both
Excel® and PowerPivot. However, PowerPivot can create a more complex and sophisticated data model.
Creating a data model allows data from various sources to be used in one PowerPivot table. This course will
cover the creation of a data model using various sources. In addition it will cover how to refresh the data used
in your model.
After you have a sound data model, you will use this model to create a PivotTable. After you have created a
PivotTable, you will use the Analyze and Design tabs to enhance your table. There are a lot of similarities
between PivotTables and PivotCharts, but there are also differences. For PivotCharts, the Analyze, Design
and Format tabs will be covered.
PowerPivot has a new language called Data Analysis Expressions (DAX). This language adds data
manipulation functionality to Excel® formulas. In addition, new functions have been added. DAX takes the
formulas that you have been using in Excel® PivotTables and PivotCharts to a whole new level. Each of the
categories of functions are described in this course.
This course will cover Key Performance Indicators (KPIs) including defining and using them in your
PivotTable. In addition, it will cover how to add and use slicers to complete what-if scenarios. Hierarchies are
created and used in a PivotTable, demonstrating the ease of using them to make reports quick and easy.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 9
Exercise 1-1 Enable PowerPivot
To begin your journey of using PowerPivot, you will need to enable PowerPivot 2016. Complete the exercise
below to enable PowerPivot.
1. In Excel® 2016, click Blank workbook.
2. Click File > Options.
3. On the left side toward the bottom, click Add-ins.
4. At the bottom of the screen, choose COM Add-ins from the manage drop down.
5. Click Go.
6. Click the check box in front of Microsoft Office Power Pivot for Excel 2016.
Note. There may be other items that have a check mark. You only need to add the one in step six.
7. Click OK.
8. On the far right, a new tab named Power Pivot is added to the Excel® ribbon.
Copyright ©2017 Pathfinder Learning, LLP
10 Excel PowerPivot 2016
Explore the PowerPivot Workspace
Now that you have successfully enabled the PowerPivot tab on the Excel® ribbon, you can take a look at the
various commands that make up PowerPivot 2016. Reviewing the commands will make it easier to find the
options that you may need later.
To use PowerPivot 2016, click on PowerPivot on the Excel® ribbon. A new PowerPivot window will open
that displays the various groups of commands that are available. Each command group displayed is
summarized below.
Figure 1-1 Power Pivot ribbon
Manage Data Model Button
The Manage Data Model button will allow you to change, add and delete elements in the data model.
This contains options to obtain data from multiple data sources. When you click on Manage, another
window will display on top of your Excel® window. This window contains the various actions that
you may take when managing your data model. This is covered in more detail in lesson two.
Figure 1-2 Manage data model
Calculations Group
The Calculations group has two buttons available: Measures and KPIs.
Figure 1-3 Calculations
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 11
Measures
The Measures button provides options to add a new measure or to manage existing measures.
A measure is an expression that is computed for an entire column instead of a row-by-row
basis. Excel® 2010 referred to them as measures. Lesson four will go into more details
regarding measures.
KPIs
The KPIs button allows you to add a new KPI or to manage existing KPIs. A KPI, or Key
Performance Indicator, is a graphical, intuitive relationship between a measure and a value.
The value can be an absolute value or another measure. Lesson five will go into more details
related to KPIs.
Tables
The Add to Data Model button allows data displayed in Excel® to be added to the PowerPivot data
model as a linked table. By linking this data, anything that is changed in the Excel® file will
automatically be updated in the data model.
The Update All button updates all of the PowerPivot tables that are linked to tables in Excel®.
Figure 1-4 Tables
Copyright ©2017 Pathfinder Learning, LLP
12 Excel PowerPivot 2016
Detect Relationships
This option will automatically find and create relationships between tables used on the selected
PivotTable.
Figure 1-5 Relationships
Settings
This button allows you to define settings for your PowerPivot environment.
Figure 1-6 Settings
When you click on Settings, it will launch another dialog box with the following tabs: Support &
Diagnostics, Language and Categorization.
Support & Diagnostics is used to collect information about your PowerPivot environment.
Language controls the language used in PowerPivot. The default is to match the language to
the language used by Excel®.
Categorization is when PowerPivot automatically assigns categories to the columns in your
model. If you share those categories (not your data, only the categories of data), then Azure
Marketplace can recommend datasets that are related to your data. Azure Marketplace is an
online market for buying and selling data and applications.
Figure 1-7 Options & Diagnostics
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 13
Compare Excel® and PowerPivot
The basic difference between PowerPivot and Excel® is that you can create a much more sophisticated data
model by working on it in the PowerPivot window. Table 1-1 contains a comparison of various tasks that can
be completed using either Excel® or PowerPivot.
Task In Excel® In PowerPivot
Import data from different Import all data from a data
sources source. Filter data and rename columns
Create tables Tables can be on any while importing data.
worksheet in the workbook.
Edit data in a table Worksheets can have more Tables are organized into
than one table. individual tabbed pages in the
Create relationships between Can edit values in individual PowerPivot window.
tables cells in a table.
Create calculations In the Relationships dialog Cannot edit individual cells in a
box. table.
Create hierarchies Use Excel® formulas.
In Diagram view or the Create
Create Key Performance Not available in Excel®. Relationships dialog box.
Indicators (KPI)
Not available in Excel®. Write advanced formulas with the
Table 1-1 Excel® vs. PowerPivot Data Analysis Expressions
(DAX) language.
Define hierarchies to use
everywhere in the workbook.
Create KPIs to use in PivotTables
Copyright ©2017 Pathfinder Learning, LLP
14 Excel PowerPivot 2016
Lesson 2: Building Data Models
Unit time: 75 minutes
In this lesson, you will:
1 Review Data Models
2 Create Data Models
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 15
Review Data Models
A data model is used to create PivotTables or PivotCharts using PowerPivot 2016. A data model is a set of
tables with relationships. A relationship is created between two tables based on a common column of data.
This column is referred to as the key. A key column is a unique value that is used to match against another
table to retrieve a record. This is also referred to as a relational database.
When creating the data model, you have the option of adding data from multiple sources. If the source is a
relational database, PowerPivot will load the data and create the relationships that existed in the original
source. The data relationships are automatically detected only for tables with a single column as the key. If
the data is from Excel® or a text file, you will need to create the relationships manually.
There are two types of relationships allowed in PowerPivot: One-to-Many and One-to-One. A One-to-Many
relationship is used when rows in table A can be matched to any number of rows in table B, but table B can
only be matched to one row in table A. A One-to-One relationship is when there is only one row in table A
that matches one row in table B and there is only one row in table B that matches one row in table A.
The diagram view within the Manage Data Model tab will display the existing tables and relationships that
have been loaded into PowerPivot. The tables are represented by boxes and lines with arrows representing the
relationships between the tables. Figure 2-1 displays the DimProductSubcategory and ProductCategory tables.
The key field in this example is ProductCategoryKey.
Figure 2-1 Diagram view displaying key fields
Copyright ©2017 Pathfinder Learning, LLP
16 Excel PowerPivot 2016
Create Data Models
Data can be loaded from many different sources to build the data model. Creating a data model happens as
soon as you create a PivotTable with more than one table.
The data that you work on in Excel® and in the PowerPivot window is stored in an analytical database inside
the Excel® workbook. Because the data is in Excel®, it is immediately available to PivotTables and
PivotCharts. PowerPivot supports files up to 2GB in size and enables you to work with up to 4GB of data in
memory.
Manage Data Model
On the PowerPivot ribbon, clicking on the Manage Data Model button will launch the window
displayed in Figure 2-2. This window is used to create, edit and delete your data model. This is also
where you will import data for use in PowerPivot.
This window will open over the top of your Excel® workspace. To get back to your Excel® window,
you do not need to close the Manage Data Model window, you can either click the appropriate
window in the task bar or use alt-tab key combination to bring the focus to the window that you want
to use.
Figure 2-2 Manage Data Model
The top portion of the window displays the buttons that you will need to use to update your data
model. This line of buttons displays at the top of both the data view and the diagram view of your
data model.
Figure 2-3 Manage Data Model Buttons
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 17
Clipboard
The Clipboard group is used to copy and paste data into your PowerPivot data model. Data
should only be added to a data model using the clipboard if the data doesn’t change
frequently. If the data is being copied into an existing table, you can choose Paste Append or
Paste Replace. Append will add the data to the table leaving the original data intact. Replace
deletes the existing data and adds the new data. If the data is being copied, in order to create a
table, the paste button is used.
Figure 2-4 Clipboard
Get External Data
Get External Data is used to import data into the data model. Table 2-1 covers the available
data sources that can be used to load data to a data model in PowerPivot. Each of the buttons
will launch the appropriate table import wizard to allow you to connect to the data source that
you need.
The table import wizard will allow you to choose if you want to import the entire data or
write a query to select only the data that you want to import. In addition, you can add filters
to the data as you import it. This is accomplished using the table import wizard.
The Existing Connections button will display all connections that have already been defined.
A connection is a data link between PowerPivot and a data source. This connection allows
data to be imported into PowerPivot. Once a data source connection is created, it should be
re-used if additional tables need to be added.
Figure 2-5 Get External Data Examples
External Data Option Access, SQL Server and Analysis Services
From Database
From Data Service Windows Azure Marketplace, Suggest Related Data and
OData Data Feed
From Other Sources
Oracle, Teradata, DB2, Sybase, Excel® files and Text
Table 2-1 External data options Files
Copyright ©2017 Pathfinder Learning, LLP
18 Excel PowerPivot 2016
Refresh
Data is imported into the PowerPivot data model. If the data changes often, you will need to
refresh the data often. This is easily accomplished by clicking the Refresh button. Data
refresh will replace the data in PowerPivot with the latest data. By making a practice of
refreshing the data each time you open the workbook, you will ensure that you are always
working with the most up-to-date information.
There are two options on the Refresh button: Refresh and Refresh All. Refresh will only
refresh the data in the current worksheet. Refresh All will bring in a new copy of the data
from all database connections. Any data that was copied into the data model is not updated.
Figure 2-6 Refresh
PivotTable
This button is used to create a new PivotTable or PivotChart. Lesson three covers the many
options available by using this button.
Figure 2-7 PivotTable
Formatting
Formatting will display the current formatting of the column. This also allows you to change
the formatting for the column. Changing the data type will change how the data is stored.
However, changing the format only changes the display of the data not how the data is stored.
Figure 2-8 Formatting
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 19
Sort and Filter
Sort enables you to maintain the sorting of the data in the column. You can also clear any sort
that has already been applied. The options to add or remove a filter on the column are also
included.
Filter allows you to add or remove filters from the displayed table. A filter removes some
data from displaying in the table.
Figure 2-9 Sort and Filter
Find
Find allows you to search for column names or table names that meet the search criteria you
entered. It does not search the data in the tables.
Figure 2-10 Find
Calculations
AutoSum allows you to create a new measure for the column that you have selected. If you
click the arrow next to AutoSum, additional calculations are available such as count, min,
max and average.
Create KPI will change a measure into a KPI. Measures and KPIs are covered later in this
course.
Figure 2-11 Calculations
Copyright ©2017 Pathfinder Learning, LLP
20 Excel PowerPivot 2016
View
Data View displays the tables and the data. This topic is covered in more detail later in this
lesson.
Diagram View will display the tables showing the relationships that have been defined. This
is also discussed in more detail later in this lesson.
Show Hidden will display any objects that have been concealed from view. Clicking the
button again will hide the objects once again.
Calculation Area will display the bottom portion of the screen which is used for creating,
editing and managing measures and KPIs within the model. If the Calculation Area is hidden
from view, click the button and it will return.
Figure 2-12 View
Data View
Below the button section is a line that displays the column that you have selected. It will
default to the first column if you have not selected a column. The column name displays first
with the data displayed next to it. See figure 2-13. Notice the data is greyed out, indicating
that the data cannot be changed. If you are adding a new calculated column, then the field
will change to a formula bar where you can enter formulas. See figure 2-14. Calculated
columns are discussed in lesson four.
Figure 2-13 Field in Table
Figure 2-14 Adding Calculated Column
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 21
The next section, is the area showing the tables and data that are present in your PowerPivot
data model. Each table is represented as a separate tab. The data that is present in each table
is displayed in the grid. In figure 2-15, the DimGeography table is being displayed. There is
only one row of data in this table. The down pointing arrow next to each column name allows
you another way to filter how the data is displayed.
Figure 2-15 Tables and data
If you right-click on a column name in one of the tables, the dialog box in figure 2-16 will
display. This will allow you to take actions on individual columns of data.
Create Relationship will display the dialog box that allows you to create a new
relationship with another table.
Navigate to Related Table will open up the tab of the table that is related to the
column that you are displaying.
Copy will duplicate the table name and the data in the column.
Insert Column will add a calculated column and name it CalculatedColumn1, 2, 3,
etc.
Delete Column will remove the column from the table. It will remove the column
name and all the data.
Rename Column allows you to change the name of the column.
Freeze Columns will allow you to stop the columns from moving when you use the
scroll bars. This can be applied to one or more columns.
Unfreeze will reverse this action.
Hide from Client Tools will remove the field from displaying in PivotTable Fields.
Column Width allows you to change the width of the column displayed.
Copyright ©2017 Pathfinder Learning, LLP
22 Excel PowerPivot 2016
Filter allows you to either add a filter or remove an existing filter from the column.
Description provides an area for you to document information about the column.
Figure 2-16 Column dialog box
Diagram View
The Diagram view begins with a Fit to Screen button for your data model. The next element
is the slider which will enlarge or reduce the size of your data model. Then there is the
Display button, which gives a popup list for including or excluding columns, measures
(measures), hierarchies, and KPIs, as well as resetting the layout to its original form. Finally,
there are buttons for switching between Data View and Diagram view.
Figure 2-17 Diagram View Reset Layout
The next section is the area that displays the tables and their relationships. Each table is
represented as a separate box. Examples of the table names are DimGeography,
DimProductSubcategory, etc. Each column in the table is listed within the box. Examples of
column names in the DimGeography table are GeographyKey, GeographyType,
ContinentName, etc. The relationships are represented as a line between the tables. Figure 2-
18 shows the data model for Contoso Sales. You will be building this data model later in this
lesson.
This section also allows you to create, edit or delete relationships between the tables. To
create a new relationship, click and hold on the field name and then drag it to the related field
name in the other table. To edit an existing relationship, double-click on the relationship line
between the two tables. This will open an edit relationship dialog box which contains a list of
the tables and columns that are available in your data model. To delete a relationship, right-
click on the line between the tables and choose delete.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 23
Figure 2-18 Diagram View Layout
When you hover over a table in the diagram view, the below icons will appear in the upper
right corner. See figure 2-19.
The first icon is the Create Hierarchy button. Clicking this button will add a new hierarchy to
this table and name it Hierarchy1. To create the hierarchy, drag the fields from that table onto
the label Hierachy1. Hierarchies are discussed in more detail in lesson five.
The next icon is the Maximize button. This will maximize this single table. Once maximized,
the Restore icon will appear. This will allow you to return the table to its original size.
Figure 2-19 Diagram View of Single Table
If you click and hold on the table name, you can move the table around within the diagram
view. This makes it easier to read your data model. When you move the tables around, it does
not affect the relationships, the lines will remain and move with the tables.
Copyright ©2017 Pathfinder Learning, LLP
24 Excel PowerPivot 2016
If you right-click on the table name or a column name, the dialog box in figure 2-20 will
display. This will allow you to take the actions described below on the columns of data.
Create Relationship will display the dialog box that allows you to create a new
relationship with another table.
Clicking Create Hierarchy will add a new hierarchy to this table and name it
Hierarchy1. To create the hierarchy, drag the fields from that table onto the label
Hierachy1.
Delete will either delete the column or table that you have selected. It presents
another dialog box to confirm that you want the object deleted.
Hide from Client Tools will remove the table or field that you have selected from
displaying in PivotTable Fields.
Go To will take you to the data view of the table that you have selected.
Rename will either rename the column or the table that you have selected.
Maximize will only display if you selected a table. This will maximize this single
table. Once maximized, the Restore icon will appear. This will allow you to return
the table to its original size.
Figure 2-20 Table right-click menu
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 25
Exercise 2-1 Import Data from Access
To create a data model for an Access database, follow the steps below. Use the ContosoSales Access database
that was provided in your Class Files\Lesson2 folder.
1. Launch Excel® 2016.
2. Click Blank workbook.
3. Click Power Pivot.
4. Click Manage Data Model. The Manage Data Model window will open.
5. Click From Database > click From Access.
Copyright ©2017 Pathfinder Learning, LLP
26 Excel PowerPivot 2016
6. Locate the ContosoSales Access database in the Lesson2 folder by clicking Browse. Click Desktop >
Class Files > Lesson2. Click ContosoSales > Open.
7. Click Next.
8. Use the default Select from a list of tables and views to choose the data to import. Click Next.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 27
9. On the Select Tables and Views window, click the check box at the top so that all the tables are selected.
10. Click Finish.
Copyright ©2017 Pathfinder Learning, LLP
28 Excel PowerPivot 2016
11. Verify the tables and data have imported successfully.
12. Click Close.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 29
13. The tables that you imported will display as tabs at the bottom of the Manage Data Model window.
14. Click File > Save As. Determine the location to save your file. Enter a name for your file. Click Save.
15. Leave the file open as you will use it for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
30 Excel PowerPivot 2016
Exercise 2-2 Import Data Using Copy and Paste
Continuing with the data model you started in exercise 2-1, you will now add data to the data model by
copying the data from an Excel® file to the data model. For this exercise you are adding a table of codes and
descriptions for the Product Category field. This data does not change so it is a perfect candidate for adding to
the data model by using the copy and paste ability.
1. Using Excel®, click File > Open.
2. Locate the Class Files\Lesson2 folder. Double-click on the DimProductCategory file.
3. Copy the data that is in the table displayed. Make sure you copy the table headings also. To copy, click
cell A1, hold down the shift key and click cell G9. Type Ctrl-C, the table should be highlighted as shown
below.
4. On the previous exercise, you left off at the Manage Data Model window. Go back to this window.
5. Click Clipboard Paste and the Paste Preview screen will display. The default is to use the first row as
column headers.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 31
6. Change the table name from Table to ProductCategory.
7. Click OK.
8. The table has now been added to your PowerPivot model. The new table will display as a tab at the
bottom of the Manage Data Model window.
9. Click Diagram View to display the updated data model. The new ProductCategory table was added to the
right side of the diagram. Use the scroll bars to display the area where the new table was added. There is
no line displayed between the DimProductSubcategory table and the new ProductCategory table, which
indicates that PowerPivot did not detect a relationship between the tables.
10. To create the relationship, in the DimProductSubcategory table, click and hold the
ProductCategoryKey field and drag over to the ProductCategoryKey field in the ProductCategory
table. Release the button.
Copyright ©2017 Pathfinder Learning, LLP
32 Excel PowerPivot 2016
11. The relationship has been created.
12. Click Data View to return back to the grid or data view of the data model.
13. Click Save.
14. Leave the file open as you will use it for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 33
Exercise 2-3 Import Data Using a Text File
Continuing with the data model you updated in exercise 2-2, you will now add data to the data model by
importing the data from a text file. Use the Stores file that was provided in your Class Files\Lesson2 folder.
The Stores file contains information about each store. This table is used to supplement the FactSales table.
1. Continuing where you left off on the previous exercise, click Get External Data > From Other Sources.
The Table Import Wizard will display.
2. Scroll to the bottom to where you see Text File. Click Text File.
3. Click Next.
4. Change the Friendly connection name from Text to Stores.
5. Click Browse and locate the Stores file in your Class Files\Lesson2 folder. Click Stores > Open.
Copyright ©2017 Pathfinder Learning, LLP
34 Excel PowerPivot 2016
6. The data displays but doesn’t look correct. This is because the default column separator is a comma. In
the Column Separator drop box, choose Tab. The data will now display properly.
7. Click Finish. Verify you received a success message.
8. Click Close.
9. The table has now been added to your PowerPivot model. The new table will display as a tab at the
bottom of the Manage Data Model window.
10. Click Diagram View to display the updated data model. The new Stores table was added to the diagram
to the right. Use the scroll bars to display the area where the new table was added.
11. It will make it easier to add the relationship if the Stores table is moved closer to the FactSales table. To
move any table, click and hold on the table name and drag it anywhere you want. When you have it
positioned, release the mouse button.
12. To create the relationship, in the FactSales table, click and hold the StoreKey field and drag over to the
StoreKey field in the Stores table.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 35
13. The relationship has been created.
14. Click Data View to return back to the table view of the data.
15. Click Save.
16. Leave the file open as you will use it for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
36 Excel PowerPivot 2016
Exercise 2-4 Import Data Using an Excel® File
Continuing with the data model you updated in exercise 2-3, you will now add data to the data model by
importing the data from an Excel® file. Use the Geography file that was provided in your Class Files\Lesson2
folder. The Geography table contains additional information related to each store found in the Stores table.
1. Continuing where you left off on the previous exercise, click Get External Data > From Other Sources.
2. The Table Import Wizard will display. Scroll to the bottom to where you see Excel File. Click Excel File.
3. Click Next.
4. Change the Friendly connection name from Excel to Geography.
5. Click Browse and locate the Geography file in your Class Files\Lesson2 folder. Click Open.
6. Click the checkbox Use first row as column headers.
7. Click Next.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 37
8. Click the check box in front of the source table DimGeography$.
9. Click Finish. Verify you received a Success message.
10. Click Close.
11. The table has now been added to your PowerPivot model. The new table will display as a tab at the
bottom of the Manage Data Model window. It is called DimGeography.
12. Click Diagram View to display the latest data model. The new DimGeography table was added to the
diagram to the right. Use the scroll bars to display the area where the new table was added.
13. It will make it easier to add the relationship if the DimGeography table is moved closer to the Stores
table. To move any table, click and hold on the table and drag it anywhere you want. When you have it
positioned, release the mouse button.
14. To create the relationship, in the Stores table, click and hold the GeographyKey field and drag over to
the GeographyKey field in the DimGeography table.
Copyright ©2017 Pathfinder Learning, LLP
38 Excel PowerPivot 2016
15. The relationship has been created.
16. Click Data View to return back to the table view of the data.
17. Click Save.
18. Leave the file open as you will use it for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 39
Exercise 2-5 Explore the Manage Data Model Tab
Now that you have completed a data model, take this time to review the various buttons and actions available
in the Manage Data Model tab.
1. The default view of the data model is the data view. Click Diagram View.
2. Review the relationships that were created.
3. Click and hold to drag each table to make the data model more readable.
4. In the Get External Data group, click Existing Connections. You should see a link for the Access
ContosoSales database, Stores text file and Geography Excel® File. Click Close.
5. Go back to the Data View and on the bottom of the screen, click the FactSales tab.
6. Click on the StoreKey column and then click Sort Smallest to Largest. Notice the table is now sorted.
7. Click Clear Sort. Notice the table is returned to the way it was before you applied the sort.
8. To add a filter to the UnitCost column, click the arrow next to the column name. Click Select All to
remove the check marks next to all the amounts. Click a couple of the dollar amounts and then OK.
Notice the records have been filtered.
9. To remove the filter, click Clear All Filters.
Copyright ©2017 Pathfinder Learning, LLP
40 Excel PowerPivot 2016
Exercise 2-6 Refresh the Data
Using the data model that you have created, you are going to update a value in the Excel® spreadsheet to see
the refresh function in action. First we will make a change to the Excel® spreadsheet. Then verify that the
data model does not contain the change until you click the Refresh button.
1. Launch Excel® 2016.
2. Click Blank workbook.
3. Click File > Open.
4. Locate your Class Files\Lesson2 folder and Click Geography > Open.
5. In the Excel® window, change the value of ETLLoadID for Asia in cell H2 from 2 to 1.
6. Save the workbook and close it.
7. In Excel®, in the Class Files\Lesson2 folder, open the file named Exercise 2-6.
8. Click Enable Content to allow editing of the file.
9. Click Power Pivot.
10. Click Manage Data Model.
11. At the bottom of the screen, click DimGeography.
12. There are automatic filter arrows added to each column. In the first column GeographyKey, click on the
filter and choose to filter only for key 2.
13. Verify that the ETLLoadID for the row is 2.
14. Click on the arrow below Refresh so that the dialog box opens. If you click on Refresh, the currently
displayed table will be updated, not the entire data model.
15. Click Refresh All.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 41
16. After the success message, click Close.
17. Verify that the ETLLoadID for the row is now 1.
18. Click Save.
Copyright ©2017 Pathfinder Learning, LLP
42 Excel PowerPivot 2016
Lesson 3: Create a PivotTable and PivotChart
Unit time: 75 minutes
In this lesson, you will:
1 Determine Chart or Table
2 Create a PivotTable
3 Create a PivotChart
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 43
Determine Chart or Table
Now that you have a data model, it is easy to create a PivotTable or PivotChart with your data. To begin, you
need to decide which layout you want to begin with. To start, choose PivotTable on the Manage Data Model
window. Figure 3-1 displays the options that are available while table 3-1 explains each of these options.
Figure 3-1 PivotTable Button Options
Layout Description
PivotTable Create one PivotTable.
PivotChart
Chart and Table (Horizontal) Create one PivotChart.
Chart and Table (Vertical) Create a PivotTable and PivotChart side by side. The data in the table and
chart are independent of each other.
Two Charts (Horizontal)
Create a PivotChart with a PivotTable positioned below the chart. The data
Two Charts (Vertical) in the table and chart are independent of each other.
Four Charts Create two PivotCharts side by side. The data in the charts are independent
Flattened PivotTable of each other.
Table 3-1 Layout Options Create two PivotCharts with them stacked one above the other. The data in
the charts are independent of each other.
Create four PivotCharts.
Create a PivotTable where data values are not arranged as row and column
headers. Instead, new columns are added and a total row is added after each
group. It makes the data appear more like a spreadsheet where each row has
data repeated.
Copyright ©2017 Pathfinder Learning, LLP
44 Excel PowerPivot 2016
Create a PivotTable
PivotTable Fields
When choosing PivotTable, the window will change to display PivotTable fields on the right side of
the screen. See Figure 3-2. In addition to the PivotTable fields, there are new contextual tabs that are
displayed: Analyze and Design. These tabs allow for further customization of your PivotTable and
are discussed later in this lesson.
Figure 3-2 PivotTable workspace
There are multiple sections within PivotTable fields. The “Choose fields to add to report” section lists
all the data sources that are in the data model. Each table is listed individually. Clicking on the arrow
to the left of the table name will expand that table so that you are able to select the fields. The fields
will appear with check boxes next to them. If you check the boxes, PowerPivot will add numeric
fields to the values drop zone with a sum calculation. Text and date fields will automatically be added
to the rows drop zone. The gear icon next to the table names allows you to customize the way the
PivotTable Fields portion of the screen will display.
The bottom section that is labeled “Drag fields between areas below,” are called drop zones. These
drop zones are used to add, move and delete rows and columns from the PivotTable. Table 3-2
explains each drop zone.
Drop Zone Description
Filters Fields in this zone are used to filter the data being displayed.
Filters are automatically placed above the column labels.
Columns
Placed across the top of the PivotTable. The list of values should
Rows be shorter than the row list.
Values Placed along the left side of the PivotTable. Usually a shorter list
than the column list and are usually text fields.
Table 3-2 PivotTable drop zones
A total calculation is automatically created for fields added to this
zone.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 45
Below the drop zones are check boxes that allow you to defer the automatic update of the layout of
the PivotTable. Checking this box will allow you to make all changes and nothing will be refreshed
until you click the Update button.
PivotTable
Figure 3-3 displays a PivotTable that was created by adding three fields from different tables to the
various drop zones. This is showing the sum of sales by year and by brand. With minimal effort, you
now have a basic PivotTable that includes fields from three different tables. What made this task so
simple were the pre-existing relationships among the tables.
Figure 3-3 PivotTable
Copyright ©2017 Pathfinder Learning, LLP
46 Excel PowerPivot 2016
Exercise 3-1 Create Your First PivotTable
For this exercise you are going to use the data model that was created in the previous exercises to create a
PivotTable. The table will be similar to the one in figure 3-3 except it will provide the detail on products in
addition to the brand name. Notice as you add each field, the PivotTable is updated and will show different
totals and information based on the fields added so far. NOTE: For this exercise, start with the file in Class
Files\Lesson3.
1. Launch Excel®.
2. Click Blank workbook.
3. Click File > Open.
4. Locate the file in the Class Files\Lesson3 folder. Click Exercise 3-1. Click Open.
5. Click Power Pivot.
6. To add a new PivotTable to the workbook, click Manage from the Data Model Group. The PowerPivot
window will display.
7. Click the arrow below the PivotTable button and click PivotTable.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 47
8. When the Create PivotTable window opens, click OK.
9. In the PivotTable Fields list, scroll down and find the FactSales table. Click the arrow to expand the
table. Click the checkbox in front of SalesAmount. Because this amount is numeric, the field is
automatically added to the values drop zone.
Copyright ©2017 Pathfinder Learning, LLP
48 Excel PowerPivot 2016
10. In the DimDate table, find the CalendarYear field. Click and hold on CalendarYear to drag this field to
the columns drop zone.
11. In the DimProductSubcategory table, find the ProductSubcategoryName field. Click and hold on
ProductSubcategoryName to drag this field to the rows drop zone.
12. In the DimProduct table, find the BrandName field. Click and hold on BrandName to drag this field to
the rows drop zone, placing it beneath the ProductSubcategoryName field.
Copyright ©2017 Pathfinder Learning, LLP
Excel® PowerPivot 2016 49
13. Congratulations! You have created your first PivotTable. Figure 3-4 shows part of the report that was
created.
Figure 3-4 Contoso sales PivotTable
Copyright ©2017 Pathfinder Learning, LLP
50 Excel PowerPivot 2016
Analyze
The PivotTable from exercise 3-1 is a great start but isn’t everything you had hoped it would be.
When you click on the PivotTable, new contextual tabs will display under the heading PivotTable
Tools. One of the available tabs is Analyze. Below is a brief description of each group on the Analyze
tab.
Figure 3-5 PivotTable Analyze
PivotTable
The PivotTable group contains a field to quickly change the default name of the PivotTable.
It also contains Options which allows for formatting of the PivotTable including: Layout &
Format, Totals & Filters, Display, Printing, Data and Alt Text. Each of the additional tabs
that display when clicking on Options are explained below.
Figure 3-6 PivotTable Group
Layout & Format
The Layout & Format tab includes options to change the layout of the table. It
includes changing the display for empty cells, allowing auto-fit of column widths and
centering of labels.
Figure 3-7 PivotTable Options
Copyright ©2017 Pathfinder Learning, LLP