Excel Power Pivot Tutorial
Excel Power Pivot Tutorial
Audience
This guide targets professionals with hands-on experience with Excel, to perform the high-
end data analysis and decision making in a matter of few minutes.
Prerequisites
Before you proceed with this tutorial, we are assuming that you are already aware about
the basics of Excel. If you are not well aware of these concepts, then we will suggest you
to go through our short tutorials on Excel charts and MS Access.
All the content and graphics published in this e-book are the property of Tutorials Point (I)
Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute, or
republish any contents or a part of contents of this e-book in any manner without written
consent of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely as
possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.
Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our
website or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at contact@tutorialspoint.com
i
Excel Power Pivot
Table of Contents
About the Tutorial ............................................................................................................................................ i
Audience ........................................................................................................................................................... i
Prerequisites ..................................................................................................................................................... i
Copyright & Disclaimer ..................................................................................................................................... i
Table of Contents ............................................................................................................................................ ii
ii
Excel Power Pivot
iii
Excel Power Pivot
iv
1. Power Pivot Overview Excel Power Pivot
Excel Power Pivot is an efficient, powerful tool that comes with Excel as an Add-in. With
Power Pivot, you can load hundreds of millions of rows of data from external sources and
manage the data effectively with its powerful xVelocity engine in a highly compressed
form. This makes it possible to perform the calculations, analyze the data, and arrive at a
report to draw conclusions and decisions. Thus, it would be possible for a person with
hands-on experience with Excel, to perform the high-end data analysis and decision
making in a matter of few minutes.
You will learn how to create Power PivotTables in the chapters Creating a Power
PivotTable and Flattened PivotTables.
You will learn how to create Power PivotCharts in the chapter Power PivotCharts.
1
Excel Power Pivot
DAX Basics
DAX is the language used in Power Pivot to perform calculations. The formulas in DAX are
similar to Excel formulas, with one difference while the Excel formulas are based on
individual cells, DAX formulas are based on columns (fields).
You will understand the basics of DAX in the chapter Basics of DAX.
Hierarchies
You can define data hierarchies in a data table so that it would be easy to handle related
data fields together in Power PivotTables. You will learn the details of the creation and
usage of Hierarchies in the chapter Hierarchies in Power Pivot.
Aesthetic Reports
You can create aesthetic reports of your data analysis with Power Pivot Charts and/or
Power Pivot Charts. You have several formatting options available to highlight the
significant data in the reports. The reports are interactive in nature, enabling the person
looking at the compact report to view any of the required details quickly and easily.
You will learn these details in the chapter - Aesthetic Reports with Power Pivot Data.
2
2. Power Pivot Installing Excel Power Pivot
Power Pivot in Excel provides a Data Model connecting various different data sources based
on which the data can be analyzed, visualized, and explored. The easy-to-use interface
provided by Power Pivot enables a person with hands-on experience in Excel to effortlessly
load data, manage the data as data tables, create relationships among the data tables,
and perform the required calculations to arrive at a report.
In this chapter, you will learn, what makes Power Pivot a strong and sought after tool for
analysts and decision makers.
If you have Excel 2010, POWERPIVOT tab might not appear on the Ribbon if you have
not already enabled the Power Pivot add-in.
Step 2: Click Options in the dropdown list. The Excel Options dialog box appears.
3
Excel Power Pivot
Click Add-Ins.
In the Manage box, select COM Add-ins from the dropdown list.
Click the Go button. The COM Add-Ins dialog box appears.
Check Power Pivot and click OK.
The Power Pivot Ribbon as shown below has various commands, ranging from managing
Data Model to creating reports.
4
Excel Power Pivot
The Power Pivot window will have the Ribbon as shown below-
The user-friendly interface of Power Pivot in the PowerPivot window enables you to perform
data operations without the knowledge of any database query language. You can then
create a report of your analysis within few seconds. The reports are versatile, dynamic
and interactive and enable you to further probe into the data to get the insights and arrive
at the conclusions / decisions.
The data that you work on in Excel and in the Power Pivot window is stored in an analytical
database inside the Excel workbook, and a powerful local engine loads, queries, and
updates the data in that database. Since the data is in Excel, it is immediately available
to PivotTables, PivotCharts, Power View, and other features in Excel that you use to
aggregate and interact with the data. The data presentation and interactivity is provided
by Excel and the data and Excel presentation objects are contained within the same
workbook file. Power Pivot supports files up to 2GB in size and enables you to work with
up to 4GB of data in memory.
Ability to handle large data volumes, compressed into small files, with amazing
speed.
Organize tables into individual tabbed pages in the Power Pivot window as against
the Excel tables distributed all over the workbook or multiple tables in the same
worksheet.
Create relationships among the tables, so as to analyze the data in the tables
collectively. Before Power Pivot, one had to rely on heavy usage of VLOOKUP
function to combine the data into a single table before such analysis. This used to
be laborious and error-prone.
5
Excel Power Pivot
You will understand the Power Pivot features in detail in the next chapter.
You can create relationships between data tables so that you can perform data analysis
on the tables collectively. With DAX, you can write advanced formulas. You can create
calculated fields and calculated columns in the data tables in the Data Model.
You can define Hierarchies in the data to use everywhere in the workbook, including Power
View. You can create KPIs to use in PivotTables and Power View reports to show at a glance
whether performance is on or off target for one or more metrics.
You can share your workbook to a SharePoint environment that has Excel Services
enabled. On the SharePoint server, Excel Services processes and renders the data in a
browser window where others can analyze the data.
6
3. Power Pivot Features Excel Power Pivot
The most important and powerful feature of Power Pivot is its database Data Model. The
next significant feature is the xVelocity in-memory analytics engine that makes it possible
to work on large multiple databases in a matter of few minutes. There are some more
important features that come with the PowerPivot Add-in.
In this chapter, you will get a brief overview of the features of Power Pivot, which are
illustrated in detail later.
Load data into Excel and then create a Power Pivot Data Model.
The second way is more efficient because of the efficient way Power Pivot handles the data
in memory.
For more details, refer to chapter Loading Data into Power Pivot.
You need not have the data in Excel tables when you are importing data from external
sources. If you have data as Excel tables in the workbook, you can add them to Data
Model, creating data tables in Data Model that are linked to the Excel tables.
When you create a PivotTable or PivotChart from Power Pivot window, they are created in
the Excel window. However, the data is still managed from Data Model.
You can always switch between the Excel window and Power Pivot window anytime, easily.
Data Model
The Data Model is the most powerful feature of Power Pivot. The data that is obtained from
various data sources is maintained in Data Model as data tables. You can create
relationships between the data tables so that you can combine the data in the tables for
analysis and reporting.
You will learn in detail about the Data Model in the chapter Understanding Data Model
(Power Pivot Database).
7
Excel Power Pivot
Memory Optimization
Power Pivot Data Model uses xVelocity storage, which is highly compressed when data is
loaded into memory that makes it possible to store hundreds of millions of rows in
memory.
Thus, if you load data directly into Data Model, you will be doing it in the efficient highly
compressed form.
Power PivotTables
You can create the Power PivotTables from Power Pivot window. The PivotTables so created
are based on the data tables in the Data Model, making it possible to combine data from
the related tables for analysis and reporting.
Power PivotCharts
You can create the Power PivotCharts from Power Pivot window. The PivotCharts so created
are based on the data tables in the Data Model, making it possible to combine data from
the related tables for analysis and reporting. The Power PivotCharts have all the features
of Excel PivotCharts and many more such as field buttons.
You can also have combinations of Power PivotTable and Power PivotChart.
DAX Language
The strength of Power Pivot comes from the DAX Language that can be used effectively
on the Data Model to perform calculations on the data in the data tables. You can have
Calculated Columns and Calculated Fields defined by DAX that can be used in the Power
PivotTables and Power PivotCharts.
8
4. Power Pivot Loading Data Excel Power Pivot
Load data into PowerPivot directly, populating the Data Model, which is the
PowerPivot database.
If you want the data for Power Pivot, do it the second way, without Excel even knowing
about it. This is because you will be loading the data only once, in highly compressed
format. To understand the magnitude of difference, suppose you load data into Excel by
first adding it to the Data Model, the file size is say 10 MB.
If you load data into PowerPivot, and hence into Data Model skipping the extra step of
Excel, your file size could be as less as 1 MB only.
9
Excel Power Pivot
The PowerPivot window opens. Now you have two windows the Excel workbook window
and the PowerPivot for Excel window that is connected to your workbook.
10
Excel Power Pivot
Click the Next > button. The Table Import Wizard displays the options for choosing how
to import data.
11
Excel Power Pivot
Click Select from a list of tables and views to choose the data to import.
Click the Next > button. The Table Import Wizard displays the tables and views in the
Access database that you have selected.
12
Excel Power Pivot
As you can observe, you can select the tables by checking the boxes, preview and filter
the tables before adding to Pivot Table and/or select the related tables.
As you can see, you can select specific columns by checking the boxes in the column
labels, filter the columns by clicking the dropdown arrow in the column label to select the
values to be included.
Click OK.
Power Pivot checks what other tables are related to the selected Medals table, if a
relation exists.
13
Excel Power Pivot
You can see that Power Pivot found that the table Disciplines are related to the table Medals
and selected it. Click Finish.
Table Import Wizard displays Importing and shows the status of the import. This will
take a few minutes and you can stop the import by clicking the Stop Import button.
Once the data is imported, the Table Import Wizard displays Success and shows the
results of the import as shown in the screenshot below. Click Close.
14
Excel Power Pivot
You can scroll through the records (rows of the table) using the Record arrows below the
tabs.
Note that the Table Import Wizard options change as per the data source that is selected
to connect to. You might want to know what data sources you can choose from.
15
Excel Power Pivot
The Table Import Wizard Connect to a Data Source appears. You can either create a
connection to a data source or you can use one that already exists.
You can scroll through the list of connections in the Import Table Wizard to know the
compatible data connections to Power Pivot.
16
Excel Power Pivot
Click the Next > button. The Table Import Wizard displays Connect to a Microsoft
Excel File.
Click the Next > button. The Table Import Wizard displays Select Tables and
Views.
17
Excel Power Pivot
You have imported one table, and you have also, created a connection to the Excel file
that contains several other tables.
18
Excel Power Pivot
The Existing Connections dialog box appears. Select Excel Sales Data from the list.
Click the Open button. The Table Import Wizard appears displaying the tables and views.
19
Excel Power Pivot
Select the tables that you want to import and click Finish.
20
Excel Power Pivot
You can see that the five tables are added to the Power Pivot, each in a new tab.
You can link the Excel table into Power Pivot in a few steps as follows -
21
Excel Power Pivot
You can see that the Table Tools with the tab - Linked Table is added to the Power Pivot
window. If you click Go to Excel Table, you will switch to the Excel worksheet. If you
click Manage, you will switch back to the linked table in the Power Pivot window.
Note that you can link an Excel table only if it is present in the workbook with the Power
Pivot. If you have Excel tables in a separate workbook, then you have to load them as
explained in the next section.
22
Excel Power Pivot
Power Pivot considers the other Excel workbook as a database and only worksheets
are imported.
Power Pivot cannot recognize single tables. Hence, Power Pivot cannot recognize if
there are multiple tables on a worksheet.
Power Pivot cannot recognize any additional information other than the table on a
worksheet.
Once your data in the workbook is ready, you can import the data as follows
Click From Other Sources in the Get External Data group in the Power Pivot
window.
The following are the differences between linked Excel tables and imported Excel tables
Linked tables need to be in the same Excel workbook in which the Power Pivot
database is stored. If the data already exists in other Excel workbooks, there is no
point in using this feature.
The Excel import feature allows you to load data from different Excel workbooks.
Loading data from an Excel workbook does not create a link between the two files.
Power Pivot creates only a copy of the data, while importing.
When the original Excel file is updated, data in the Power Pivot will not be refreshed.
You need to either set the update mode to automatic or update the data manually,
in the Linked Table tab of the Power Pivot window.
If you want to load a csv file into Power Pivot, you have to use the Text File option. Suppose
you have the following text file with csv format
23
Excel Power Pivot
Click From Other Sources in the Get External Data group. The Table Import
Wizard appears.
Click the Next > button. Table Import Wizard appears with the display Connect
to Flat File.
24
Excel Power Pivot
Browse to the text file in the File Path box. The csv files usually have the first line
representing column headers.
Check the box Use first row as column headers, if the first line has headers.
In the Column Separator box, default is Comma (,), but in case your text file has
any other operator such as Tab, Semicolon, Space, Colon or Vertical Bar, then
choose that operator.
As you can observe, there is a preview of your data table. Click Finish.
25
Excel Power Pivot
Copy the data to an Excel file and use the Excel file as data source for Power Pivot.
Copy the data, so that it will be on the clipboard, and paste it into Power Pivot.
You have already learnt the first option in an earlier section. And this is preferable to the
second option, as you will find at the end of this section. However, you should know how
to copy data from clipboard into Power Pivot.
Word is not a data source for Power Pivot. Therefore, perform the following-
26
Excel Power Pivot
The data copied into the clipboard will be pasted into a new data table in Power Pivot, with
the tab Word-Employee table.
27
Excel Power Pivot
28
Excel Power Pivot
The Paste Preview dialog box appears. Verify the contents that you are using for replace.
Click OK.
As you can observe, the contents of the data table in Power Pivot are replaced by the
contents in the clipboard.
Suppose you want to add two new rows of data to a data table. In the table in the Word
document, you have the two news rows.
29
Excel Power Pivot
Click Copy.
Click Paste Append in the Power Pivot window. The Paste Preview dialog box
appears.
Click OK to proceed.
30
Excel Power Pivot
As you can observe, the contents of the data table in Power Pivot are appended with the
contents in the clipboard.
In the beginning of this section, we have said that copying data to an excel file and using
linked table is better than copying from clipboard.
If you use linked table, you know the source of the data. On the other hand, you
will not know the source of the data later or if it is used by a different person.
You have tracking information in the Word file, such as when the data is replaced
and when the data is appended. However, there is no way of copying that
information to Power Pivot. If you copy the data first to an excel file, you can
preserve that information for later use.
While copying from clipboard, if you want to add some comments, you cannot do
so. If you copy to Excel file first, you can insert comments in your Excel table that
will be linked to the Power Pivot.
There is no way to refresh the data copied from clipboard. If the data is from a
linked table, you can always ensure that the data is updated.
If you want to refresh only one data table in the Power Pivot, do the following
31
Excel Power Pivot
If you want to refresh all the data tables in the Power Pivot, do the following
32
5. Power Pivot Data Model (Database) Excel Power Pivot
A Data Model is a new approach introduced in Excel 2013 for integrating data from multiple
tables, effectively building a relational data source inside an Excel workbook. Within Excel,
Data Model is used transparently, providing tabular data used in PivotTables and
PivotCharts. In Excel, you can access the tables and their corresponding values through
the PivotTable / PivotChart Field lists that contain the table names and corresponding
fields.
The main use of Data Model in Excel is its usage by Power Pivot. Data Model can be
considered as the Power Pivot database, and all the power features of Power Pivot are
managed with the Data Model. All data operations with Power Pivot are explicit in nature
and can be visualized in the Data Model.
Data Model, if exists in the workbook, will be displayed as tables, each one with a tab.
Note: If you add an Excel table to Data Model, you will not transform the Excel table into
a data table. A copy of the Excel table is added as a data table in the Data Model and a
link is created between the two. Hence, if changes are done in the Excel table, the data
table also is updated. However, from the storage point of view, there are two tables.
In fact, you can manage the Data Model from Power Pivot window. You can add data to
Data Model, import data from different data sources, view the Data Model, create
relationships between the tables, create calculated fields and calculated columns, etc.
33
Excel Power Pivot
You will understand how to add tables from Excel to the Data Model in the chapter
Loading Data through Excel. You will understand how to load data into Data Model in the
chapter Loading Data into Power Pivot.
A table in the Data Model is considered as a set of records (a record is a row) made up of
fields (a field is a column). You cannot edit individual items in a data table. However, you
can append rows or add calculated columns to the data table.
A data table on the other hand coexists with other data tables with relationships,
facilitating the combination of data from multiple tables. Data tables get created when you
import data into Power Pivot. You can also add Excel tables to the Data Model while you
are creating a Pivot Table getting external data or from multiple tables.
The data tables in the Data Model can be viewed in two ways
Data View.
Diagram View.
34
Excel Power Pivot
35
Excel Power Pivot
Table relationships will be created automatically if you import related tables that have
primary and foreign key relationships. Excel can use the imported relationship information
as the basis for table relationships in the Data Model.
You can also explicitly create relationships in either of the two views
In the diagram view, you can create the relationship by clicking on the field in the table
and dragging to the related table.
You will learn more about relationships in the chapter - Managing Data Tables and
Relationships with Power Pivot.
36
6. Power Pivot Managing Data Model Excel Power Pivot
The major use of Power Pivot is its ability to manage the data tables and the relationships
among them, to facilitate analysis of the data from several tables. You can add an excel
table to the Data Model while you are creating a PivotTable or directly from the PowerPivot
Ribbon.
You can analyze data from across multiple tables only when relationships exist among
them. With Power Pivot, you can create relationships from the Data View or Diagram View.
Moreover, if you had chosen to add a table to the Power Pivot, you need to add a
relationship as well.
One containing the data of salespersons and the regions they represent, in a table-
Salesperson.
Another containing the data of sales, region and month wise, in a table Sales.
37
Excel Power Pivot
An empty PivotTable with the fields from the Sales table Region, Month and Order
Amount will be created. As you can observe, there is a MORE TABLES command below
the PivotTable Fields list.
The Create a New PivotTable message box appears. The message displayed is- To use
multiple tables in your analysis, a new PivotTable needs to be created using the Data
Model. Click Yes.
38
Excel Power Pivot
Under PivotTable Fields, you can observe that there are two tabs ACTIVE and ALL.
Two tables- Sales and Salesperson, with the corresponding fields appear in the
PivotTable Fields list.
Click the field Salesperson in the Salesperson table and drag it to ROWS area.
Click the field Month in the Sales table and drag it to ROWS area.
Click the field Order Amount in the Sales table and drag it to VALUES area.
39
Excel Power Pivot
Click the CREATE button next to the message. The Create Relationship dialog box
appears.
40
Excel Power Pivot
Further, as Excel stated while adding the second table to the PivotTable, the PivotTable
got created with Data Model. To verify, do the following
You can observe that the two Excel tables that you used in creating the PivotTable are
converted to data tables in the Data Model.
41
Excel Power Pivot
You can add the Excel table from a different workbook to the Data Model as follows
42
Excel Power Pivot
You will get an empty PivotTable on a new worksheet with only the fields corresponding
to the Sales table.
You have added the Sales table data to the Data Model. Next, you have to get the
Salesperson table data also into Data Model as follows
Click Existing Connections in the Get External Data group. The Existing Connections
dialog box appears.
Under This Workbook Data Model, 1 table is displayed (This is the Sales table that you
added earlier). You also find the two workbooks displaying the tables in them.
43
Excel Power Pivot
You can see that the box Add this data to the Data Model is checked and inactive.
Click OK.
As you can observe the two tables are in the Data Model. You might have to create a
relationship between the two tables as in the previous section.
44
Excel Power Pivot
One containing the data of salespersons and the regions they represent, in a table
Salesperson.
Another containing the data of sales, region and month wise, in a table Sales.
You can add these Excel tables to the Data Model first, before doing any analysis.
45
Excel Power Pivot
Power Pivot window appears, with the data table Salesperson added to it. Further a tab
Linked Table appears on the Ribbon in the Power Pivot window.
46
Excel Power Pivot
You can find that the names of the two tables present in your workbook are displayed and
the name Salesperson is ticked. This means the data table Salesperson is linked to the
Excel table Salesperson.
47
Excel Power Pivot
If you want to do analysis based on these two tables, as you are aware, you need to create
a relationship between the two data tables. In Power Pivot, you can do this in two ways
48
Excel Power Pivot
Click on Sales in the Table box. This is the table from where the relationship starts. As
you are aware, Column should be the field that is present in the related table
Salesperson that contains unique values.
49
Excel Power Pivot
50
Excel Power Pivot
The Diagram View of the Data Model appears in the Power Pivot window.
A line appears from the table Sales to the table Salesperson indicating the
relationship
51
Excel Power Pivot
As you can see, a line appears from the Sales table to the Salesperson table, indicating
the relationship and the direction.
If you want to know the field that is a part of a relationship, click on the relationship line.
The line and the field in both the tables are highlighted.
52
Excel Power Pivot
Managing Relationships
You can edit or delete an existing relationship in Data Model.
All the relationships that exist in the Data Model are displayed.
53
Excel Power Pivot
To edit a relationship
Click on a Relationship.
Click the Edit button. The Edit Relationship dialog box appears.
To delete a relationship
Click on a Relationship.
Click on the Delete button. A warning message appears showing how the tables that
are affected by deleting the relationship would affect the reports.
Click OK if you are sure you want to delete. The selected relationship is deleted.
The data table is updated with the modifications made in the Excel table.
As you can observe, you cannot modify data in the data tables directly. Hence, it is better
to maintain your data in Excel tables that are linked to the data tables when you add them
to the Data Model. This facilitates updating the data in data tables as and when you update
the data in Excel tables.
54
7. Power PivotTable Creation Excel Power Pivot
Power PivotTable is based on the Power Pivot database, which is called the Data Model.
You have already learnt the powerful features of the Data Model. The power of Power Pivot
is in its ability to summarize data from the Data Model in the Power PivotTable. As you are
aware, the Data Model can handle huge data spanning millions of rows and coming from
diverse inputs. This enables Power PivotTable to summarize the data from anywhere in a
matter of few minutes.
Power PivotTable resembles PivotTable in its layout, with the following differences-
PivotTable is based on a single Excel table or data range, whereas Power PivotTable
can be based on multiple data tables, provided they are added to Data Model.
PivotTable is created from Excel window, whereas Power PivotTable is created from
PowerPivot window.
55
Excel Power Pivot
Create PivotTable dialog box appears. As you can observe, this is a simple dialog box,
without any queries on data. This is because, Power PivotTable is always based on Data
Model, i.e. the data tables with the relationships defined among them.
As you can observe, the layout of the Power PivotTable is similar to that of PivotTable. The
PIVOTTABLE TOOLS appear on the Ribbon, with ANALYZE and DESIGN tabs, identical
to PivotTable.
The PivotTable Fields List appears on the right side of the worksheet. Here, you will find
some differences from PivotTable.
56
Excel Power Pivot
Note that the ALL tab displays all the data tables in the Data Model and ACTIVE tab
displays all the data tables that are chosen for the Power PivotTable at hand. As the Power
PivotTable is empty, it means that no data table is selected yet; hence by default, ALL tab
is selected and the two tables that are currently in the Data Model are displayed. At this
point, if you click the ACTIVE tab, the Fields list would be empty.
Click on the table names in the PivotTable Fields list under ALL. The corresponding
fields with check boxes will appear.
Each table name will have the symbol on the left side.
If you place the cursor on this symbol, the Data Source and the Model Table Name
of that data table will be displayed.
57
Excel Power Pivot
As you can observe, the field Salesperson appears in the PivotTable and the table
Salesperson appears under the ACTIVE tab as expected.
58
Excel Power Pivot
Again, click the ACTIVE tab. Both the tables Sales and Salesperson appear under the
ACTIVE tab.
59
Excel Power Pivot
60
Excel Power Pivot
61
8. Power Pivot Basics of DAX Excel Power Pivot
DAX (Data Analysis eXpression language is the language of Power Pivot. DAX is used
by Power Pivot for data modeling and it is convenient for you to use for self-service BI.
DAX is based on data tables and columns in data tables. Note that it is not based on
individual cells in the table as is the case with the formulas and functions in Excel.
You will learn the two simple calculations that exist in Data Model Calculated Column
and Calculated Field in this chapter.
Calculated Column
Calculated column is a column in the Data Model that is defined by a calculation and that
extends the content of a data table. It can be visualized as a new column in an Excel table
defined by a formula.
62
Excel Power Pivot
As you can observe, the Power PivotTable has summarized the sales data from all the
regions. Suppose you want to know the gross profit made on each of the products. You
know the price of each product, the cost at which it is sold and the number of units sold.
However, if you need to calculate the gross profit, you need to have two more columns in
each of the data tables of the regions Total Product Price and Gross Profit. This is
because, PivotTable requires columns in data tables to summarize the results.
As you know, Total Product Price is Product Price * No. of Units and Gross Profit is Total
Amount Total Product Price.
63
Excel Power Pivot
You need to use DAX Expressions to add the Calculated Columns as follows
Click the East_Sales tab in Data View of the Power Pivot window to view the
East_Sales Data Table.
Click Add.
64
Excel Power Pivot
The column on the right side with the header - Add Column is highlighted.
Type = [Product Price]*[No. of Units] in the formula bar and press Enter.
65
Excel Power Pivot
A new column with header CalculatedColumn1 is inserted with the values calculated by
the formula you entered.
66
Excel Power Pivot
Press Enter.
A new column with header CalculatedColumn1 is inserted with the values calculated by
the formula you entered.
67
Excel Power Pivot
Add the Calculated Columns in the North_Sales data table in a similar way. Consolidating
all the steps, proceed as follows
Click Add. The column on the right side with the header - Add Column is highlighted.
Type =[Product Price]*[No. of Units] in the formula bar and press Enter.
A new column with header CalculatedColumn1 gets inserted with the values
calculated by the formula you entered.
68
Excel Power Pivot
Click Add. The column on the right side with the header - Add Column is highlighted.
Repeat the above given steps for the South Sales data table and West Sales data table.
69
Excel Power Pivot
You have the necessary columns to summarize the Gross Profit. Now, create the Power
PivotTable.
You are able to summarize the Gross Profit that became possible with the calculated
columns in the Power Pivot and it all can be done just in a few steps that are error-free.
You can summarize it region wise for the products as given below also-
70
Excel Power Pivot
Calculated Field
Suppose you want to calculate the percentage of profit made by each region product-wise.
You can do so by adding a calculated field to the Data Table.
Click below the column Gross Profit in the East_Sales table in Power Pivot window.
Press Enter.
71
Excel Power Pivot
The calculated field EastProfit is inserted below the Gross Profit column.
72
Excel Power Pivot
Note: You cannot define more than one calculated field with a given name.
73
Excel Power Pivot
Click on the Power PivotTable. You can see that the calculated fields appear in the tables.
Select the fields EastProfit, NorthProfit, SouthProfit and WestProfit from the tables in
the PivotTable Fields list.
Arrange the fields such that the Gross Profit and Percentage Profit appear together.
The Power PivotTable looks as follows-
Note: The Calculate Fields were called Measures in earlier versions of Excel.
74
9. Power PivotTable Exploring Data Excel Power Pivot
In the previous chapter, you have learnt how to create a Power PivotTable from a normal
set of data tables. In this chapter, you will learn how you can explore data with Power
PivotTable, when the data tables contain thousands of rows.
For a better understanding, we will import the data from an access database, which you
know is a relational database.
75
Excel Power Pivot
76
Excel Power Pivot
The Table Import wizard displays options for choosing how to import data.
Click Select from a list of tables and views to choose the data to import and click
Next.
The Table Import Wizard displays all the tables in the Access database that you have
selected. Check all the boxes to select all the tables and click Finish.
77
Excel Power Pivot
The Table Import Wizard displays Importing and shows the status of the import. This
may take a few minutes and you can stop the import by clicking the Stop Import button.
Once the data import is complete, Table Import Wizard displays Success and shows the
results of the import. Click Close.
78
Excel Power Pivot
Power Pivot displays all the imported tables in different tabs in Data View.
79
Excel Power Pivot
You can observe that a relationship exists between the tables Disciplines and Medals.
This is because, when you import data from a relational database such as Access, the
relationships that exist in the database also are imported to the Data Model in Power Pivot.
Select New Worksheet in the Create PivotTable dialog box that appears and click
OK.
80
Excel Power Pivot
All the imported tables that are a part of Power Pivot Data Model appear in the PivotTable
Fields list.
Drag the NOC_CountryRegion field in the Medals table to the COLUMNS area.
Filter Discipline to display only five sports: Archery, Diving, Fencing, Figure Skating,
and Speed Skating. This can be done either in PivotTable Fields area, or from the
Row Labels filter in the PivotTable itself.
Select Medal from the Medals table again and drag it into the FILTERS area.
81
Excel Power Pivot
The PivotTable is populated with the added fields and in the chosen layout from the areas.
82
Excel Power Pivot
The Value Filter dialog box appears. Type 80 in the right-most box and click OK.
The PivotTable displays only those regions with total number of medals more than 80.
You could arrive at the specific report that you wanted from the different tables in just few
steps. This became possible because of the pre-existing relationships among the tables in
the Access database. As you imported all the tables from the database together at the
same time, Power Pivot recreated the relationships in its Data Model.
83
Excel Power Pivot
84
Excel Power Pivot
Create a relationship between the tables Disciplines and Sports with the field SportID.
85
Excel Power Pivot
86
Excel Power Pivot
Create a relationship between the tables- Events and Medals with the field
DisciplineEvent.
87
Excel Power Pivot
Press Enter.
88
Excel Power Pivot
A new column is created with the header CalculatedColumn1 and the column is filled by
the values resulting from the above DAX formula.
Right-click on the new column and select Rename Column from the dropdown list.
89
Excel Power Pivot
As you can see, the column EditionID has unique values in the Hosts table.
90
Excel Power Pivot
Type the DAX formula in the formula bar =YEAR ([EDITION]) and press Enter.
Rename the new column that is created as Year and click Add.
91
Excel Power Pivot
As you can observe, the EditionID column in the Medals table has identical values as the
EditionID column in the Hosts table. Therefore, you can create a relationship between the
tables Medals and Sports with the EditionID field.
Create a relationship between the tables- Medals and Hosts with the field that is
obtained from the calculated column i.e. EditionID.
Now you can add fields from Hosts table to Power PivotTable.
92
10. Power PivotTables Flattened Excel Power Pivot
When the data has many levels, sometimes it becomes cumbersome to read the PivotTable
report.
Creating a PivotTable
You can create a Power PivotTable as follows
93
Excel Power Pivot
Drag the fields Salesperson, Region and Product from the PivotTable Fields list to the
ROWS area.
Drag the field TotalSalesAmount from the Tables East, North, South and West to
the VALUES area.
As you can see, it is a bit cumbersome read such a report. If the number of entries
becomes more, the more difficult it will be.
Power Pivot provides a solution for a better representation of data with Flattened
PivotTable.
94
Excel Power Pivot
Create Flattened PivotTable dialog box appears. Select New Worksheet and click OK.
95
Excel Power Pivot
Note: In this case Salesperson, Region and Product are in ROWS area only as in the
previous case. However, in the PivotTable layout, these three fields are appearing as three
columns.
You can make it look more flattened by dragging VALUES to ROWS area from the
COLUMNS area.
96
Excel Power Pivot
Rename the custom names of the summation values in the VALUES area to make them
more meaningful as follows
Drag No. of Units to the VALUES area from each of the tables East_Sales,
North_Sales, South_Sales and West_Sales.
Rename the values to East Total No. of Units, North Total No. of Units, South Total
No. of Units and West Total No. of Units respectively.
97
Excel Power Pivot
As you can observe, in both of the above tables, there are rows with empty values, as
each salesperson represents a single region and each region is represented only by a single
salesperson.
As you can observe, though the rows with empty values are not displayed, the information
on the Salesperson also got hidden.
98
Excel Power Pivot
As you can observe, the Salesperson information is displayed and the rows with empty
values are hidden. Further, the column Region in the report is redundant, as the values in
the Values column are self-explanatory.
Reverse the order of the fields Salesperson and Product in the ROWS area.
You have arrived at a concise report combining data from six tables in the Power Pivot.
99
11. Power PivotCharts Creation Excel Power Pivot
A PivotChart based on Data Model and created from the Power Pivot window is a Power
PivotChart. Though it has some features similar to Excel PivotChart, there are other
features that make it more powerful.
In this chapter, you will learn about Power PivotCharts. Henceforth we refer to them as
PivotCharts, for simplicity.
Creating a PivotChart
Suppose you want to create a PivotChart based on the following Data Model.
100
Excel Power Pivot
The Create PivotChart dialog box appears. Select New Worksheet and click OK.
101
Excel Power Pivot
As you can observe, all the tables in the data model are displayed in the PivotChart Fields
list.
Two field buttons for the two selected fields appear on the PivotChart. These are the Axis
field buttons. The use of field buttons is to filter data that is displayed on the PivotChart.
102
Excel Power Pivot
Click on the button at the top right corner of the PivotChart. The Chart
Elements dropdown list appears.
Uncheck the box Legend in the Chart Elements list. The Legend is removed from the
PivotChart.
103
Excel Power Pivot
Select Hide Value Field Buttons on Chart from the dropdown list.
Note: The display of field buttons and/or legend depends on the context of the PivotChart.
You need to decide what is required to be displayed.
104
Excel Power Pivot
Likewise, the areas are as in the case of Excel PivotChart. There four areas are-
AXIS (Categories)
LEGEND (Series)
VALUES
FILTERS
As you have seen in the previous section, Legend is populated with Values. Further, field
buttons are added to the PivotChart for the ease of filtering the data that is being
displayed.
105
Excel Power Pivot
Filters in PivotChart
You can use the Axis field buttons on the chart to filter the data being displayed. Click on
the arrow on the Axis field button Region.
106
Excel Power Pivot
You can select the values that you want to display. Alternatively, you can place the field
in FILTERS area for filtering the values.
Drag the field Region to FILTERS area. The Report Filter button- Region appears on the
PivotChart.
107
Excel Power Pivot
Click on the arrow on the Report Filter button Region. The dropdown list that appears
looks as follows-
Slicers in PivotChart
Using Slicers is another option to filter data in the Power PivotChart.
All the tables and the corresponding fields appear in the Insert Slicer dialog box.
108
Excel Power Pivot
Click the field Region in Salesperson table in the Insert Slicer dialog box.
As you can observe, the Region field still exists as an Axis field. You can select the values
that you want to display by clicking on the Slicer buttons.
Remember that you are able to do all these in a few minutes and also dynamically because
of the Power Pivot Data Model and defined relationships.
109
Excel Power Pivot
PivotChart Tools
In Power PivotChart, the PIVOTCHART TOOLS has three tabs on the Ribbon as against two
tabs in Excel PivotChart
ANALYZE
DESIGN
FORMAT
The options on the Ribbon under FORMAT tab are all for adding splendor to your
PivotChart. You can use these options judiciously, without getting over bored.
110
12. Table and Chart Combinations Excel Power Pivot
Power Pivot provides you with different combinations of Power PivotTable and Power
PivotChart for data exploration, visualization, and reporting. You have learnt the
PivotTables and PivotCharts in the previous chapters.
In this chapter, you will learn how to create the Table and Chart combinations from within
the Power Pivot window.
Consider the following Data Model in Power Pivot that we will use for illustrations-
111
Excel Power Pivot
Create PivotChart and PivotTable (Horizontal) dialog box appears. Select New Worksheet
and click OK.
112
Excel Power Pivot
113
Excel Power Pivot
As you can see, USA has the highest number of Medals (> 4500).
114
Excel Power Pivot
115
Excel Power Pivot
The Create PivotChart and PivotTable (Vertical) dialog box appears. Select New
Worksheet and click OK.
As you can observe, year 2008 has the highest number of Medals (2450).
116
Excel Power Pivot
117
13. Power Pivot Hierarchies Excel Power Pivot
A hierarchy in Data Model is a list of nested columns in a data table that are considered
as a single item when used in a Power PivotTable. For example, if you have the columns
Country, State, City in a data table, a hierarchy can be defined to combine the three
columns into one field.
In the Power PivotTable Fields list, the hierarchy appears as one field. So, you can add
just one field to the PivotTable, instead of the three fields in the hierarchy. Further, it
enables you to move up or down the nested levels in a meaningful way.
Creating a Hierarchy
You can create Hierarchies in the diagram view of the Data Model. Note that you can
create a hierarchy based on a single data table only.
Click on the columns Sport, DisciplineID and Event in the data table Medal in that
order. Remember that the order is important to create a meaningful hierarchy.
118
Excel Power Pivot
The hierarchy field with the three selected fields as the child levels gets created.
Renaming a Hierarchy
To rename the hierarchy field, do the following
119
Excel Power Pivot
Type EventHierarchy.
Click the PivotTable tab on the Ribbon in the Power Pivot window.
Click PivotTable on the Ribbon.
120
Excel Power Pivot
The Create PivotTable dialog box appears. Select New Worksheet and click OK.
121
Excel Power Pivot
In the PivotTable Fields list, EventHierarchy appears as a field in Medals table. The other
fields in the Medals table are collapsed and shown as More Fields.
The fields under EventHierarchy will be displayed. All the fields in the Medals table will be
displayed under More Fields.
122
Excel Power Pivot
As you can observe, the three fields that you added to the hierarchy also appear under
More Fields with check boxes. If you do not want them to appear in the PivotTable Fields
list under More Fields, you have to hide the columns in the data table Medals in data
view in Power Pivot Window. You can always unhide them whenever you want.
123
Excel Power Pivot
The values of Sport field appear in the PivotTable with a + sign in front of them. The medal
count for each sport is displayed.
Click on the + sign before Aquatics. The DisciplineID field values under Aquatics
will be displayed.
Click on the child D22 that appears. The Event field values under D22 will be
displayed.
124
Excel Power Pivot
As you can observe, medal count is given for the Events, that get summed up at the parent
level DisciplineID, that get further summed up at the parent level Sport.
As you are aware, the tables Medals and Disciplines are related. You can add the field
Discipline from Disciplines table to the Medals table, by creating a column using the
relationship with DAX.
The column Add Column on the right side of the table is highlighted.
125
Excel Power Pivot
Rename the new column thus obtained in the Medals table as Discipline. Next, you have
to remove DisciplineID from the Hierarchy and add Discipline, which you will learn in the
following sections.
126
Excel Power Pivot
The field DisciplineID gets deleted from the hierarchy. Remember that you have removed
the field from hierarchy, but the source field still exists in the data table.
127
Excel Power Pivot
128
Excel Power Pivot
129
Excel Power Pivot
As you can observe, in the PivotTable Fields list, the child levels in the EventHierarchy
reflect the changes you made in the Hierarchy in Data Model. The same changes also get
reflected in the PivotTable accordingly.
Click the + sign in front of Aquatics in the PivotTable. The child levels appear as values of
the field Discipline.
Uncheck the box Hierarchies in the top menu of diagram view to hide the hierarchies.
Check the box Hierarchies to show the hierarchies.
130
Excel Power Pivot
1. Click the Create Hierarchy button on the top right corner of the Medals data table in
diagram view.
A new hierarchy gets created in the table without any fields in it.
131
Excel Power Pivot
Drag the fields Year and Season, in that order to the new hierarchy. The hierarchy shows
the child levels.
132
Excel Power Pivot
Drag the field season to the hierarchy. The hierarchy shows the child levels.
133
Excel Power Pivot
Deleting a Hierarchy
You can delete a hierarchy from the Data Model as follows
134
Excel Power Pivot
135
Excel Power Pivot
The child levels are displayed as the percentage of the Parent Totals. You can verify this
by summing up the percentage values of the child level of a parent. The sum would be
100%.
136
Excel Power Pivot
Click the Quick Explore tool - that appears at the bottom right corner of the
cell containing the selected value.
The Explore box with Drill Up option appears. This is because from Event you can only
drill up as there are no child levels under it.
137
Excel Power Pivot
Click on the Quick Explore tool - that appears at the bottom right corner of the cell
containing a value.
Explore box appears with Drill Up and Drill Down options displayed. This is because from
Discipline you can drill up to Sport or drill down to Event.
This way you can quickly move up and down the hierarchy.
138
14. Power Pivot Aesthetic Reports Excel Power Pivot
You can create aesthetic reports of your data analysis with Power Pivot Data that is in Data
Model.
You can use PivotCharts to produce visual reports of your data. You can use Report
Layouts to structure your PivotTables to make them easily readable.
You can use a common Slicer for both the PivotChart and the PivotTable that are
in the same report.
Once your final report is ready, you can choose to hide the Slicers form the display.
You will learn how to get reports with the options that are available in Power Pivot in this
chapter.
139
Excel Power Pivot
140
Excel Power Pivot
Select USA.
Drag Gender from Medals table to GENDER area.
141
Excel Power Pivot
142
Excel Power Pivot
Report Layout
Create PivotTable as follows
Click on the arrow button next to Column Labels and select Aquatics.
143
Excel Power Pivot
Type 80 in the box next to Count of Medal is greater than or equal to in the Value Filter
dialog box.
144
Excel Power Pivot
Click Report Layout and select Show in Outline Form from the dropdown list.
145
Excel Power Pivot
The field names appear in place of Row Labels and Column Labels and the report looks
self-explanatory.
146
Excel Power Pivot
Select New Worksheet and click OK. An Empty PivotChart and an empty PivotTable appear
next to each other in a new worksheet.
147
Excel Power Pivot
Click PivotChart.
Drag Discipline from Disciplines table to AXIS area.
Drag Medal from Medals table to VALUES area.
Click PivotTable.
Drag Discipline from Disciplines table to ROWS area.
Drag Medal from Medals table to VALUES area.
148
Excel Power Pivot
Two Slicers NOC_CountryRegion and Sport appear. Arrange and size them to align
properly next to the PivotTable.
149
Excel Power Pivot
As you can observe, the PivotChart is not filtered. To filter PivotChart with the same filters,
you need not insert Slicers again for PivotChart. You can use the same Slicers that you
have used for the PivotTable.
You can see that all the PivotTables and PivotCharts in the workbook are listed in the dialog
box.
Click on the PivotChart that is in the same worksheet as the selected PivotTable
and click OK.
150
Excel Power Pivot
The PivotChart is also filtered to the values selected in the two Slicers.
151
Excel Power Pivot
152
Excel Power Pivot
As you can observe, the symbol appears next to the objects in the Selection Pane. This
means those objects are visible.
153
Excel Power Pivot
You can see that the two Slicers are not visible in the Report.
154