Mastering Excel
Mastering Excel
Mark Moore
Mastering Excel
Power Query
Mark Moore
Copyright © 2016 by Mark Moore. All rights reserved worldwide. No part of
this publication may be replicated, redistributed, or given away in any form
without the prior written consent of the author/publisher or the terms relayed to
you herein.
Follow Along Workbooks
If you want to work along the exercises in this lesson (I strongly recommend
this), please go to my website and download the follow-along workbooks. My
website is:
http://markmoorebooks.com/power-pack-bundle/
The follow along workbooks you will get in your email contain files for all
the lessons in this bundle. Each lesson has its own .zip file to help you
manage all the files.
Why do I do this?
I can’t package an Excel file with an eBook; Amazon will not allow it. Also,
the only thing I do with your email is send you the workbook and periodically
send you updates about new lessons that I am working on.
Introduction
This lesson will focus on an almost unknown feature that Microsoft packaged
in Excel: Power Query. Power Query is pretty awesome. It gives you several
tools that you can use to audit and analyze your workbooks. If you find yourself
constantly trying to figure out how other peoples’ Excel files work or what they
changed or anything like that, this will be right up your alley. It’s the kind of
thing that once you see it, you’ll wonder how you ever lived without it.
What is Power Query?
Microsoft is taking Excel in a new direction. Microsoft has included in Excel
some very powerful tools to help users analyze large volumes of data. This
analysis is usually called Business Intelligence (BI). Previously, processing
and working with these large data sets was limited to experienced technical
professionals who used expensive software packages. Microsoft wants to do
away with that. They want to bring BI to the average user. They use the term
‘Self Service Business Intelligence’ to indicate that users can now perform this
analysis without calling in their IT departments or external consultants.
Microsoft’s toolset is called the Excel BI toolkit. It has several different tools:
This lesson will start with Power Query. Later lessons will continue with the
rest of the Excel BI toolkit.
Power Query
This lesson will focus on how to use Power Query to connect to external data
sources and manipulate the data so you can use it in Excel. Once the data is in
Excel you can build dashboards from it, use it in a Pivot Table, or load it into
the other Excel BI tools to create some spectacular presentations.
I want to mention one minor item that more advanced Excel users might be
confused about. What about MSQuery? MSQuery is a tool that also comes with
Excel. I have a lesson specifically on MS Query. MS Query connects to a data
source and returns the data into Excel. In that respect it functions identically as
Power Query.
However, Power Query can do much more. Power Query can connect to
multiple data sources, join them together and put them into one spreadsheet.
Power Query can also perform joins, exclusions, and manipulate the data
before it even gets to Excel.
For example, suppose you routinely connect to your sales database and extract
the sales data for the current month. With MS Query you will return the data
and then work in Excel to split out the full name files into First, Last, Middle.
You also have to write several formulas to fix any errors or missing data. You
will repeat this process every month. Of course, the more data cleaning you
have to do, the more tedious the task is.
Power Query can do all of this data cleaning and manipulation for you. You
can set up your data cleaning process so that it executes before the data gets
loaded into Excel.
Power BI
You might hear the term Power BI as you learn about Excel BI Toolkit. Power
BI is part of SharePoint Online. With Power BI, you can share all the analysis
you have performed in Excel with users across your organization. Users can
apply filters to the data so they can see only what they need to see.
Another BI related term you will come across is ETL. ETL is an acronym for
Extract, Transform and Load. This is the process of connecting to the data
(Extract), shape the data into a more functional form (Transform). It can then be
loaded into Excel or another presentation tool like Power View or Power Map
(Load).
Data Destination
There are two places into which you can load the Power Query data: Excel or
the Excel Data Model. If you load the data into Excel, it will appear as a data
table that can be refreshed (it will re-connect to the source and retrieve new
data). If the rows do not fit into an Excel worksheet, then you load it into the
Data Model and you can use Power Pivot on the data. Power Pivot will be
covered in the next lesson.
Note that when you expand the Details section, you must download the correct
version for your PC. If you have a 64-bit machine, you need to download the
64-bit version of Power Query. A 32-bit computer needs the 32-bit Power
Query version.
After installing Power Query, you will see a new tab in Excel.
There is a lot of new stuff that I am going to cover. Power Query has a lot of
functionality. It’s not difficult to understand, there’s just a lot of it. This is the
Power Query ribbon:
Before you do anything in Power Query, you need to connect to the data source.
Power Query can connect to many different types of data sources. I will not
cover them all, but I will show you what’s available. You can then poke around
and see what is applicable to your IT environment.
From Web
When you click on this button, a pop up window will appear and you can type
in the URL from which to retrieve data.
From File
You have many options available when connecting to file data sources. Most
are self-explanatory. You will be working with these connections in this
lesson.
From Database
In corporate environments, most of the data is stored in some type of central
database. These are the ones to which you can connect. Note that you will need
to have a database login and password to access the data.
Sometimes, IT people get very protective of their databases and won’t grant
you access. If you run into that, one trick that I have used is to say you need
Read Only access. This tends to calm the IT folk down quite a bit. Read Only
access means you can’t mess anything up.
From Azure
Microsoft Azure is a SaaS (Software as a Service) database technology. This
means that you can buy the software on an as-needed basis. For example,
instead of buying and installing SQL Server on a server in your company, you
could set up the database on Azure and then pay every month based on how
much you used it.
Microsoft also has an Azure Marketplace where you can buy access to
datasets. There are datasets related to demographics, employment statistics,
and weather patterns. It is pretty cool and much of the data you can access for
free (up to a certain record count).
After Power Query connects, you will see the Navigator window.
The left side of the Navigator window displays all the tables that are available
on the web page. That particular web page on my site only has one table.
6. Click on Table 0.
Now you can get a preview of some of the data from the webpage on the right
side of the Navigator. The preview pane will not load all the data, just a few
records.
Bear in mind that no data has been loaded into Excel, you can peek at the data
in the Navigator. This is a neat feature that you can use for data exploration.
There’s no need to download hundreds, or thousands of records into Excel
only to find out you were in the wrong table in the first place.
You can also refresh the query by clicking the small page button at the top right
of the Navigator window. This is great if you connect to a table that changes
frequently, like currency exchange rate data or stock prices.
7. Click on the Load button.
Excel will connect to the web page and load the data.
NOTE: This is not a download of the data in the webpage; this is a live
connection to the webpage.
This is the simplest method to load data into Excel with Power Query. You just
connected to a data source and pulled in the raw data. Of course, sometimes
this isn’t enough. Even in this simple example, there is a minor error. Notice
how your column headers are treated as data rows and not header rows. To fix
that, you have to shape the data.
Workbook Queries
Power Query remembers how it previously loaded data. Each load is stored in
a query package. You can see the query package on the right pane.
Try this.
Let’s work with a CSV (comma-separated) file to see the Editor in action.
CSV Files
Whoa, this is a completely new interface. Welcome to the Query Editor! There
is a TON of functionality here. A lot of the features are self-explanatory. For
those easy ones, I will just point them out and state what they do (i.e. Sort
Ascending). The other complex features I will have hands-on time to help you
understand how to use them.
Queries: A workbook can have multiple queries in it. If you click on the
vertically-aligned Queries keyword along the left side, you can switch
between queries.
There’s a small button to the left of Column1 and above row 1; if you click this
button you will see many of the same options that appear in the ribbon. This is
just another way to use the same features.
Column Order: If you don’t like the column order, you can click the column
header and drag the column to where you want it.
Renaming Columns: You don’t have to keep the same column names as the
source data. Right-click the column and select Rename to rename the column.
Query Settings
Over on the right, you’ll see the Query Settings window. Here you can rename
the query. Right now it is called StatesAndCapitals.
The Applied Steps pane will record any changes you make to the data. This is
how Power Query remembers what you did and reapplies all the steps when
you click Refresh. You can also reorder your steps; step back in time to an
earlier step. You will learn how to use this feature in a later section.
You should be in the Home tab of the Query Editor. Let’s review the buttons in
the ribbon.
Close Group
This group has one button, Close & Load. Clicking this button closes the
Query Editor and returns data to the spreadsheet.
If you click on the small back arrow, you will get additional options letting you
load the query result to a different worksheet. By default, the data will be
loaded into the currently active worksheet.
Query Group
Properties - Opens a new window where you can rename the query, add a
description or set the query for Fast Data Load (this might make Excel
unresponsive though).
Advanced Editor - This is where you can manually change the code that
Power Query generates as you use it. It’s like recording a macro except that
Power Query uses a new programming language called M. We aren’t going to
go into that in this lesson.
Choose Columns: Opens a new window where you can choose which
columns to return to Excel.
Remove Columns: Removes the currently selected column from the query.
Hands-On Time: Let’s do a quick exercise before you get too bored reading
all the button functions. You should have the Query Editor open with the
StatesAndCapitals data in it.
Column2 is now gone. Ohh wait! That was a mistake. You really do need
column 2. What to do?!? Don’t freak out.
Column2 now appears in the query. You can also think of the Applied Steps as
a multiple undo feature. If you have some really dirty data and you have to add
calculations, split columns, etc., you can play around with the required steps,
see the results in Power Query and remove them if they are incorrect. At the
end of the process, you can get the cleanest-possible data set into Excel.
Keep Rows
Keep Top Rows - Keep the top x number of rows in the dataset.
Keep Bottom Rows - Keep the bottom x number of rows in the dataset.
Keep Range of Rows - Keep a specific number of rows from the data
set. You set the starting and ending rows.
Remove Rows
Remove Top Rows - Remove the top x number of rows from the dataset.
Remove Bottom Rows - Remove the bottom x number of rows from the
dataset.
Remove Alternate Rows - Remove a specified number of rows from
the dataset based on a pattern you specify.
Sort
Transform
Here is where Power Query starts to shows its power (get it? Power Query,
shows its power? Gimme a break, Excel is hard to make funny). You can start
to shape the data in Power Query. This is the T in ETL (Extract Transform
Load). Without Power Query, you would need to add extra columns in Excel
and add the formulas there.
Let’s use a different source file that we can do some transformations on. You
are going to use an Excel file as a data source. This file is pretty messed up
and you are going to clean it up in Power Query.
1. Close the Power Query window (use the x at the right of the window
and discard your changes).
2. In the Power Query window, select File, From Excel.
After Power Query connects to SalesData.xlsx you will see the Navigator
window.
4. Select Table1. A preview of the table will appear in the right hand
pane.
Why select Table1 vs. Sheet1? You always want to select the smallest data set
possible. If all your data is in a table (it is in this workbook), then why load
the entire spreadsheet? Moreover, if there are additional columns with
comments, random formulas, etc., you will have to perform extra steps to clean
that data.
You don’t want to load the data into Excel yet. Don’t click Load, instead click
Edit. This will open the Query Editor.
5. Click Edit.
Now you need to start cleaning the data. Apparently, the structure of this file
doesn’t conform to accepted database standards. For example, Region is not
the only region, this column has a dash and the salesperson appended to it. You
need to split that column into two.
6. Click on the Region column to select it.
7. Click on the Split Column button.
8. Select By Delimiter.
Notice those three option buttons. If you have experience with the Text to
Columns feature in Excel you’ll see that you have a few more options in Power
Query to split a column. You can choose the right-most or left-most delimiter
as the split point.
11. Click OK. The column has been split into two columns. Now rename
the columns.
12. Right-click on Region.1.
13. Select Rename.
14. Rename the column to Region.
15. Follow the same steps to rename Region.2 to Salesperson.
16. Select the Region column.
17. Replace the region Intl with International.
18. Click on Replace Values.
19. Fill in the box with the values to find and replace.
FYI:
Match Entire Cell Contents: If you put ‘art’ in the Value to Find box it will
replace the art in artist, art, part, rampart, etc. If you only want to replace cells
that only contain ‘art’ then check this box. Note that this option also exists in
Excel’s normal Find/Replace feature. You just have to click the Options button
in the Find/Replace box. It’s called Match entire cell contents.
Data Types
Let’s talk about data types. Most of the time, Excel users don’t have to worry
about data types, Excel (and Power Query) do a very good job of figuring out
numbers vs text, dates, etc. However, since you are going to be performing
analysis on imported data or including it in a chart, it is better to make sure the
data is what you expect in the beginning (on import), rather than having to
change it later.
Changing data types can also help you clean the data. Continue working with
the current query to see how this works.
The first row has an error. Something went wrong with changing the data type.
Take a step back in time in your data transformation process to see what the
previous value was.
You can choose to remove the errors by clicking the Remove Errors
button.
You can add a calculated column that tests for errors and replaces errors
with a default date.
You can fix the source data.
The way you choose to fix the error is up to you but the goal here was to show
you that being kind of paranoid about correct data types can help you spot
errors.
Let’s start with a brand new query. You can close and discard your changes or
you can insert a new worksheet and create a second query in the existing
workbook, it is up to you.
The GroupBy.xlsx file is very similar to the SalesData.xlsx file. I just removed
a few columns to make teaching this part a bit easier.
3. Click on Table1.
4. Click Edit to go to the Query Editor.
Now, suppose you just need to know the average Qty Sold by region. In Power
Query, you would Group the column.
6. In the new window, change the values so they match this image:
7. Click OK.
Your data set changes and now you only have the Region and the Grouped By
columns.
You can also Group by more than one column. Let’s see how that works.
C’mon, you have to admit that it’s pretty cool that Power Query remembers all
your steps and you can delete any you like. You can also click and drag steps to
change the order they are performed.
7. Click OK.
Your dataset now has the average Qty Sold for each combination of Region and
Salesperson. For reference, this image has the raw data and the data that has
been grouped by Region and Salesperson.
Notice how there are two records for South and Barbara on the left image.
They get averaged into 602 in the right image.
Why would you use this? Excel already has Pivot Tables or SUMIFS. It all
depends on your needs. Excel gives you different ways to do the same thing.
Here are a few notes on why this might be better that Pivot Table/Formulas:
Append Queries
Appending queries is the act of combining two queries into one. There are a
few conditions that have to be met:
The two data sources must have identical data structures:
For example, if you get the same sales data set every month and they are
identical, then you can use this method to combine the files.
4. Select FebSales.xlsx.
5. Click OK.
6. Click on FebSales in the Navigator (FebSales is the sheet name).
7. Click OK.
Now both queries have been combined into one query. You can now return this
to Excel and build a Pivot Table or dashboard off the combined data,
When appending queries, the data sources do not have to be the same type.
You can append a CSV file with an Excel file, as long as they have the same
structure. Even if they don’t have the same structure, you can make them have
the same structure. Move the columns around, change the data types, rename
the columns, delete columns, do whatever you need to make them identical,
then append them. You don’t have to change the data source to fit; you shape
the data in Power Query to suit your needs.
Merging Queries
If you are familiar with database terms, merging queries is what Power Query
calls a SQL join. Basically what this means is that you have two tables and
they both have one field in common. You can use this common field to create a
relationship between the tables and pull records from both tables based on the
common value.
You can also use merge to perform aggregations on the data. For example,
suppose you have a table with customers and you have another larger table
with customer invoices. Every customer can have one or many invoices (this is
a one-to-many relationship). You can use Power Query to aggregate the
customer invoice data for you. You are going to do exactly that; join two CSV
files and use Power Query to aggregate the data for you.
1. Open a new Excel workbook.
2. Import Companies.csv.
3. Add a new query to CompanyInvoice.csv (click New Source, File,
CSV).
When you are performing these merges, you should spend some time
understanding your data. In this case, looking at the data shows us the
relationship between the data sets.
The ‘one’ side of the relationship is the left hand table. Each company has its
ID and the corresponding salesperson. Since there are many of the same ID’s in
the right hand table, that one is the ‘many’ side. Taking a step back, and thinking
from a business perspective, it makes sense. One company will usually have
many invoices.
Once again, to be clear: The goal is to build a query that will return the
company data along with the sum of all the invoices.
Now you have linked the source files. The Power Query display shows a new
column. You need to click on the new column and tell Power Query which
records to return and that you want to perform an aggregation.
9. Click on the double-headed arrow in the NewColumn.
10. Select Aggregate (the options will change when you do this).
11. Select Sum of Invoice Total.
Now you have built a query that merges two CSV files and calculates the total
invoice amount.
Types of Joins
Power Query lets you define several types of joins between tables. Let’s
define them.
Inner: This is the most common. This will return records from both queries
where the common field is equal.
Left Outer: Merge will return all records from left table and only matching
records from right table.
Right Outer: Merge will return all records from right table and only matching
records from left table.
Full Outer: Merge will return all records from both tables.
Left Anti: Merge will return records from left table where there is no match in
right table.
Right Anti: Merge will return records from right table where there is no match
in left table.
Transform Tab
So far, you have reviewed all the buttons in the Power Query Home tab. Now
look at the Transform tab. You’ll see that many of these buttons are identical. I
will just review the new buttons/features in this section.
Table Group
Count Rows: This will count the number of rows and give you one record
with the row count (this is a good way to see if all the records will fit on a
worksheet).
1. Close all other Power Query windows that you have open.
2. Import the file Unpivot.csv.
Many times you’ll receive files in this format. Having the months going across
like this is not very useful for analytical purposes. In this case, you can’t easily
sum up all the months to see a full year value. The solution is to unpivot this
data.
3. Shift + Click to select all the month columns. They will be highlighted
to indicate they are selected.
The query will now have all the months in one column and the values in the
following column.
5. (Optional) - You can rename the Attribute column to Month.
Pivot Columns: This is the opposite of the Unpivot Columns. Using the
previous example, you highlight the Attribute column, click Pivot Columns and
Power Query will create one column for each month.
You’ve already seen the Split Column button so I’m going to skip that.
Extract: Extracts values from the column and replaces the column with the
values. For example, if you had a column with the full month name (January,
February, etc.) and you used Extract for the first three characters, the column
would be transformed to only have Jan, Feb, etc.
Parse: This command is used to connect to websites that deliver data in either
an XML or JSON format.
These commands will be grayed out until you click on a column that contains
numbers. All the functions in this group will change the column contents and
apply the specified calculation.
For example, if you wanted to round the numbers in a column, you would click
Rounding and then Round Up, Round Down or round to a specified number of
decimal places.
Add Column Tab
Once again, when you click over to the Add Column tab, you’ll see many
familiar buttons.
Add Custom Column: This is a new feature where you can add columns with
a custom calculation.
Let’s work through a simple example so you can see how this works. You are
going to add a column that multiplies Price times Qty Sold to derive Extended
Price.
In my case, it has been a few days since I last opened this file. I see this
prompt:
Very convenient. Power Query warns me that my preview might be stale. I’m
going to click Refresh.
8. Click OK.
Folder Metadata
For this example, I am using the path C:\Common which contains all my
follow-along workbooks. When you do this exercise, use the folder that
contains your follow-along workbooks, if you want the images to match
exactly. It’s not necessary though, you’ll see. You can choose any folder you
like that has many files in it.
I am going to show you how to use Power Query to retrieve metadata from all
files in a folder. Metadata is data about data. This won’t retrieve the data
inside each workbook but it will give you data about each workbook. It will
make more sense when you see the results.
4. Click Browse and navigate to the folder with all the follow-along
workbooks (or the folder that interests you).
5. Click OK.
If you deal with many different files this is very convenient. For example, if
you are working with file submissions from other departments, salespeople or
whatever, you can run this query, load it into Excel then see who has, or has not
submitted files.
The data is now in Excel in a table. OK, so what? Heh heh, just watch.
The query, remembers what you did. When you clicked refresh, Power Query
read the contents of the folder, parsed them and loaded them into the table. That
means as people submit files, all you have to do is refresh the existing table to
get the latest results.
One last thing, in the Query Editor, there is a column named attributes. The
column has an icon with two arrows in it.
If you click on that arrow, you get a pop up window where you can include
additional metadata about all the files.
Loading Multiple Files
Along similar lines, what if you receive several different files from other
departments that need to be combined? Yes, we did cover merging queries a
few sections ago but what if you get dozens or hundreds of files? You aren’t
really going to merge all those files by hand. There must be a better way. There
most certainly is.
Now you are going to combine all the files in the folder with Power Query.
Now you are back at the metadata query results you saw in the last exercise.
However, notice how the first column, the Content column has a different icon
than Attributes has?
6. Click on the Content button.
That’s it. The columns are combined! Now you just have to remove extra
header rows and use the headers as row names.
9. Scroll down to find a header row. My data has a header row in row
20. (This is the header row from the second file.)
10. Click on Month.
Just like the previous exercise, Power Query remembers the steps you took.
When you get next month’s data file, just save it to the Monthly Sales folder
and refresh the table. Power Query will read the folder contents again and the
new month will be included in Excel. In other words, when clicking Refresh,
Power Query will process all the files in the folder.
Summary
We have gone through quite a lot of material in this lesson. And I haven’t
covered everything that Power Query can do. However, this lesson will give
you a solid foundation on Power Query that you can build upon.
The Power BI toolset included in Excel is very powerful, and gives regular
users the ability to manage extremely large data sets without having to call in
IT or consultants. Power Query is just the first step. Once the data is in Excel
then what? Then you need to use Power Pivot to analyze the data.
Power Pivot is like a super powered way to manage data sources. I will cover
using Power Pivot in the next lesson.
Mastering Excel
PowerPivot
Mark Moore
Copyright © 2016 by Mark Moore. All rights reserved worldwide. No part of
this publication may be replicated, redistributed, or given away in any form
without the prior written consent of the author/publisher or the terms relayed to
you herein.
Introduction
Welcome to another Mastering Excel lesson. If you have previous lessons,
thanks for sticking around. If you are new, I hope you enjoy the lesson. The
lessons are easy going, relaxed, no-nonsense and easy to understand. I try my
best to explain complex topics in a simple and entertaining way. My goal is
that you will finish reading each lesson and have immediately applicable skills
you can use at work or home.
This lesson will focus on a new Excel feature: PowerPivot. Excel is quickly
becoming a very powerful data management tool. Excel 2003 was ok in that it
could store up to 65,536 rows of data and 256 columns. Then Excel 2007 came
along and now it can store up to 1,048,576 rows and 16,000 columns. That’s a
lot of data but truthfully with technology generating so much data, that’s not big
enough. Many companies generate much more data than can be stored in Excel.
I want to set expectations for this lesson. If you are going to use Excel to its
maximum potential and manage large (very large) amounts of data, this is the
lesson for you. PowerPivot is how to set up the data so it can be used by other
very cool Excel features that will elegantly display the data (Power Map and
Power View). PowerPivot is the workhorse. The issue is that you really won’t
‘see’ anything in this lesson. I mean, of course you will see PowerPivot and
what it does. What I mean is that you won’t see the amazing graphs because
those are handled by Power Map or Power View. In this lesson you are
working behind the scenes getting everything ready so the other two programs
can use the data.
Even though the data sets you will be working with here are small, think about
managing several millions of rows.
What is PowerPivot?
Microsoft is taking Excel in a new direction. Microsoft has included in Excel
some very powerful tools to help users analyze large volumes of data. This
analysis is usually called Business Intelligence (BI). Previously, processing
and working with these large data sets was limited to experienced technical
professionals that used expensive software packages. Microsoft wants to do
away with that. They want to bring BI to the average user. They use the term
‘Self Service Business Intelligence’ to indicate that users can now perform this
analysis without calling in their IT departments or external consultants.
Microsoft’s toolset is called the Excel BI toolkit. It has several different tools:
PowerPivot
There’s a new ‘thing’ in Excel you may have heard of called a Data Model.
PowerPivot is closely intertwined with this Data Model. ‘Data Model’.
Sounds intimidating right? Many IT folks like to impress non-IT people with
their terms (and Data Model is one of them) but don’t worry. It’s not that
complicated.
A data model is just several tables that have predefined relationships. That is,
one column of one table matches another column of another table. Those
columns can be set up as a relationship. When you do that, you are working
with a relational data model. In pure Excel terms, if you write a VLOOKUP
formula that pulls a match from a second worksheet, you just built a relational
model.
In my previous lessons I talk about building your Excel models in layers. The
data layer, the business logic layer and the presentation layer. The data layer is
represented as a worksheet with all your data records. That’s okay but now,
PowerPivot really is a true data layer. Not only does it have the records of
interest, but you will be able to build relationships between multiple tables
and add calculations.
1. Click on File.
2. Click on Options.
3. Click on Add-Ins.
4. In the drop down list at the bottom of the window, select COM Add-
Ins.
5. Click Go.
6. Select Microsoft PowerPivot for Excel.
7. Click OK.
You will now have a new PowerPivot tab in Excel.
Excel 2010
PowerPivot exists for Excel 2010. The installation is not difficult but it takes a
few steps. You need to install some programs before installing PowerPivot.
1. Install .NET Framework 4.0 and Visual Studio 2010 Tools for Office
Runtime.
2. If you are running Windows Vista or Windows Server 2008, install the
platform update.
3. Install Microsoft® Office 2010.
4. Download PowerPivot for Microsoft Excel. The current link on the
Microsoft website is: https://www.microsoft.com/en-
us/download/details.aspx?id=29074
Important: If you install the 32-bit version of Excel, you must use the 32-bit
version of PowerPivot. If you install the 64-bit version of Excel, you must use
the 64-bit version of PowerPivot.
Note: When you start Microsoft Office 2010 Excel for the first time, you will
be prompted for permission for Excel to load SQL Server 2012 PowerPivot
for Microsoft Excel 2010.
5. After you install .NET Framework 4.0 and Visual Studio 2010 Tools
for Office Runtime, click the Download button in the webpage.
6. Double-click the 32-bit or 64-bit msi file that was downloaded in step
4.
Note that if you are using PowerPivot for Excel 2010, the images in your
version will be different than the images in this lesson.
Power Query
This is the simplest data source for PowerPivot. You used Power Query to
connect to the data source and prepared the data. Instead of loading the data
into an Excel spreadsheet, you loaded the data into the Excel Data model. With
the data in the Data Model, PowerPivot can connect directly to the data model
and begin working with it.
Data Source > Power Query > PowerPivot > Pivot Table or Power Map or
Power View
Relational Databases
This is the data source you will almost always use (either directly or through
Power Query). PowerPivot is excellent at handling millions of rows. Although
you could load .CSV files with millions of rows, more often than not, you will
be connecting to a relational database.
I’m not going to show you how to download and install a relational database
engine; that’s out of scope for an Excel lesson. However, if doing this interests
you, search online for SQL Server Express. This is a free Microsoft database
engine that you can download and install on your PC. There are several
tutorials that explain step-by-step how to install and configure it.
3. Fill out the requirements for the data source. I have my sample
database stored in C:\Common.
4. Click Next.
In this next window, you can choose to use a wizard to select a table to import
or write native SQL to retrieve data. If your IT department gave you a SQL
statement, you can select the ‘Write a query...’ option and paste in the SQL
there.
5. For this exercise, choose the ‘Select from a list of tables and views to
choose the data to import’.
This next step is optional but worthwhile to discuss. The sample database has
one table: Location. This table should be selected and you will be importing
the entire table. However, realistically you are not going to import entire tables
into your model. For your quarterly analysis, do you really want 20 years of
historical data? Probably not. PowerPivot gives you the ability to filter out
rows from being imported into the data model.
The Table Import Wizard will display the records imported and if there were
any errors.
Power Query - PowerPivot doesn’t have many options to fix import errors. It
just gets the data. This is why Power Query is so useful. Power Query can
apply several sophisticated treatments to the data to clean it up and then get it
ready for PowerPivot.
9. Click Close.
Now it looks like the data is in Excel but it is not. Notice that you are still in
the PowerPivot interface. Each table will appear in its own tab (Much like
Excel. Yeah, I know it’s confusing). Remember the big picture, you will be
importing several tables into PowerPivot (the interface you are looking at
now) and then creating relationships (and calculations) between the tables.
There are two ways to import data into Excel: as a Static Table and as a
Linked Table.
Static Table
Sometimes, you just need to get the data into the data model. If the data doesn’t
change (suppose it is a list of sales regions), then this is the easiest way to load
data. Basically you just copy the data from Excel and paste it directly into
PowerPivot.
Note that when you do all the following exercises, you can leave the
PowerPivot window up, click back to Excel and do normal Excel stuff.
7. Click OK. The Regions data has been pasted as a new table.
Adding New Records
Adding a new record to the Regions table is pretty straightforward except you
need to use a new button.
1. Copy cell A6 from the Regions workbook (the cell that says
International).
2. Go back to PowerPivot.
3. In the Home tab, click the Paste Append button.
4. The Paste Preview will appear. Click OK to paste and append the
new record.
This is how you add static data to PowerPivot. This means that if the source
data changes, PowerPivot will not update itself. You cannot change data
once it is in PowerPivot. Go ahead, try to type over the North region. You
can’t. PowerPivot consumes data, it does not change it. If you want to update a
static table, you need to copy the new data and select Paste Replace.
This is a much more useful feature. Now you will import a table into
PowerPivot but keep the link to the table active. This means once the data in
the Excel table is updated, you can refresh the data in PowerPivot and the
newly-updated data will appear in PowerPivot. This is very similar to how
Pivot Tables work.
5. Right-click on the PowerPivot Regions tab.
6. Select Delete.
7. Click Yes when prompted to delete.
10. Check that the data range is correct and that the ‘My table has headers’
box is checked.
11. Click OK.
That’s it. The new table in PowerPivot is linked to the Excel table. You can
see in PowerPivot that the linked table has a link icon in the Table tab.
The data in PowerPivot will be updated. Note that if the source file is open,
PowerPivot will refresh automatically.
Data Types
Decimal Numbers: Negative values range from -1.79 e+308 through -2.23E
-308. Positive values range from 2.23 e-308 through 1.79 e+308.
You can find the exact specifications in the Microsoft website here:
https://msdn.microsoft.com/en-us/library/gg413463%28v=sql.110%29.aspx
Managing Data
Now that you know how to import data into PowerPivot, you are ready to
create a data model. Granted, you could just use one table, build a pivot table
and call it a day but then why bother with PowerPivot in the first place? The
big deal (well, one of the big deals, there are others I will cover later) with
PowerPivot is that you can create relationships between tables. If you have
worked with Microsoft Access, it is extremely similar.
Let’s start by importing a few external data sets and work with them in
PowerPivot.
4. Repeat steps 2 and 3 to add linked tables for the States, Products and
SalesData worksheets.
Right now, you are in the PowerPivot data view. You can see the individual
data values and get a feel for the data in each table. To create relationships, it
is better to use the diagram view.
The data view is great to explore and get familiar with your data. Once you
know the data you can switch to this view. In this exercise, I named the key
fields explicitly and logically (I wish database people would do the same.
You’ll see when you connect to the data. Every table will have a ‘Key’ field
instead of ‘Client ID’).
You can see that the Clients table has a ClientID field. The SalesData table
also has a ClientID field. This is the common field and we can use this to
create a relationship between Clients and SalesData.
A Quick Explanation
If having common fields between tables is a new concept for you, look at this
image:
Using common fields means efficient data storage. It also means faster
processing. Although replacing new customer names in the gray table would
take a few seconds, imagine if you had several million tables. A Find/Replace
operation will take quite some time to finish.
One last point and not to get too geeky on you but you will probably hear these
terms when dealing with data; so let me explain them using the blue and green
tables in the above image.
The green table also has the ClientID but you see that it is repeated. That
means it is not unique; it can’t be a primary key. The ClientID field in the green
table is called a foreign key (FK). A foreign key is always a primary key of a
different table.
This is waaay important for managing data. Keys enforce something called
referential integrity. It sounds freaky huh? “Hey doc, I woke up with a huge
pain in my referential integrity. Can you give me some meds so I can go to
work?” :-)
What it means is that every row in the green table must have a related record
in the Client table identified by a ClientID. The keys maintain the integrity of
the references between tables. Why is this important? If we did not enforce this
rule, a person could input any number of sales in the green table with no
clients! That’s fraud! You would be inflating your sales numbers by entering
false sales. No client would ever get billed.
All right, that’s as far as I’m going into that here. I left out A LOT of details
here, but my goal was just to give you an idea of the why and how these related
fields are so important.
Back to PowerPivot...
1. Click the ClientID field in the Clients table and drag it to the ClientID
field in the SalesData table.
You will see the relationship arrow between the tables.
What’s up with that weird arrow, the numbers and the asterisk?
More databasey stuff. The 1 means, well, 1. The * means many. That arrow is
shorthand for saying “there is a one to many relationship between Clients and
SalesData”. In other words, one client can buy many items. Yeah, that makes
sense.
Changing Relationships
If you mess up with the click and drag to create a relationship, don’t worry.
You can right-click the relationship line and select Delete to delete it.
This pane appears. You can use the drop downs to change the tables and then
click the column header to change the related fields.
Sigh, I wish it was that easy to change relationships in real life...
2. Click Cancel to exit this relationship (I’m not touching that one...)
3. Click and drag StateID from the States table to the StateID in the
Clients table.
4. Click and drag the ProductID from the Products table to the ProductID
in the SalesData table
Now you are going to do something pretty cool. You are going to use the data
model in a Pivot Table.
You will now see the standard Pivot Table window. But wait, what data source
are you going to use? Look at the pane, there’s a new button available, ‘Use
this workbook’s Data Model’
You’ll see that the Pivot Table interface looks a little different. Instead of just
columns, you see the Data Model tables and their corresponding fields.
You will not have the ‘Use this workbook’s Data Model’. Instead follow these
steps to source the Pivot Table from the Data Model:
11. Click on these fields to add them to the Pivot Table: ClientName,
Product, SalePrice, Cost.
The Pivot Table should look like this:
From now on, you can do almost anything you usually do with a Pivot Table.
Almost because Pivot Tables sourced from OLAP data behave a bit differently
than normal Pivot Tables. For example, as of this writing you cannot add
calculated fields or calculated items to this Pivot Table. Hopefully, these items
will be resolved by Microsoft soon.
Take a step back now and think about what PowerPivot let you do. You took
three separate worksheets, loaded them into the Excel Data Model and built a
Pivot Table using them as if they were a single table.
This feature alone will make your dashboards and reports exponentially more
powerful. Think about a Data Model that has data in Excel, data from your
accounting system and data from the Web. You can combine all those data
sources directly in Excel and use a Pivot Table with slicers, conditional
formatting, dynamic charts and all the other Excel features to present your
information.
Hierarchies
You can create hierarchies in PowerPivot that will make navigating fields in a
Pivot Table very easy for you and your users. Let’s see how this works.
You are going to add a new table to the SalesData workbook with Regions and
then map each State to a Region. Then you will set up a hierarchy where each
State is a child of its respective Region.
Now you have to map each State to its Region in the States worksheet. No, I’m
not going to make you do each State by hand. That’s too tedious! I have already
done the mapping for you.
The States in the States worksheet and in the StatebyRegion workbook are in
the same order, you just have to copy paste from one into the other.
6. Click in any cell inside the State table (you are now in the SalesData
workbook).
7. Click on the Design ribbon to design the table.
8. Click Resize Table.
You will see new Region column with banded row formatting applied.
All right, you added a new Region table and you added the related records in
the State table. Now you have to update the Data Model.
11. Go back to the PowerPivot window. If you closed it, you can click on
Manage in the PowerPivot ribbon.
Check out the States Table. The RegionID field is already there. What? How?
Remember you built this as a linked table. Any changes to the Excel table will
get reflected in the Data Model. Pretty sweet.
If the RegionID field does not show up, click on the Refresh button in the
PowerPivot ribbon.
Now you have to add the Region table to the Data Model.
15. Check to make sure the range is correct. Check the ‘My table has
headers’ checkbox.
The table has now been added to the Data Model. Let’s follow best practices
and rename the table. Then create a new relationship from this table to the
States table.
Let’s recap. All of this has just been prep work! The ultimate goal is to create
a hierarchy of Region and State. The problem was that the Data Model did not
have the required data. You had to update the source data and then update the
Data Model. Along the way, you go some more practice with PowerPivot.
A hierarchy lets users drill down from a parent to a child. In this case, the user
will be able to expand the Regions to see the States under it.
There a few conditions that you have to follow when creating hierarchies. The
first condition (and it is a bit annoying) is that the fields of the hierarchy
cannot be in different tables.
See how Region Name and Name are in different tables? That’s how a good
data model is built but hierarchies don’t like that.
20. Click on the Grid button to see the data grid view. (It’s at the bottom
right of the PowerPivot window).
In Excel you probably have input a helper column with VLOOKUP or other
formulas to retrieve extra information from other worksheets. You can do the
same thing in PowerPivot. In this case, you are going to add a new calculated
column that will retrieve the Regions from the Region table. Conceptually, it is
exactly like writing a VLOOKUP formula. However, you are doing it in
PowerPivot and it is much simpler since you have already set up the table
relationships. Once again, we are doing this just so we can have States and
Regions in the same table.
Nooooo, you do not want to redesign your tables to put the Regions directly in
the States tables. If you have multi-million rows, it will slow everything down
to crawl.
Let’s bring in the related records from Region into States. Wait until you see
how easy this is...
22. Click on the first row in the Blank column, then click in the formula
bar.
Since there is only one relationship in this table, PowerPivot lists the potential
choices for you.
Now that you have both the parent (RegionName) and the child (Name) in the
same table, you can build a hierarchy.
29. Click the diagram view button (at the bottom right of the PowerPivot
window).
32. Click and drag the Name field under RegionName (RegionName).
Now let’s see how this new hierarchy can be used.
36. Drag the Geography item to the columns and remove the SalePrice
field (you are removing it so it’s easier to see the hierarchy).
Take a peek at your Pivot Table. You now see the parents Central, Northern,
Pacific, Southern and Western. However, you can click on them to drill down
to their children.
This hierarchy had just one level but you can add as many levels as you need
to. To do add more levels, drag additional fields in PowerPivot into the
hierarchy. The order of the fields under the Geography hierarchy determines
which is parent and child. You can move the fields around until you get the
right order.
If you drag Geography to the Filters section of the Pivot Table, Excel will filter
the entire Pivot Table by the parent or child.
Bonus Exercise
4. Select Geography.
5. Click OK.
Two slicers are created. One for RegionName and another for Name. The great
thing is that if you select a Region, all the related States will also be selected.
Users can select a Region (and all the States in the region) or an individual
State.
Calculated Columns
Calculated columns are almost identical to the calculated columns you use in
Excel. In Excel, you input a formula in a cell, then you drag it down to the last
row. In PowerPivot, you just click in ‘Add Column’, input the formula in the
formula bar and press Enter. PowerPivot will apply the formula to every row.
Let’s create a simple calculated column that derives the Net Profit in the Sales
Data table.
You’ll see that PowerPivot displays a list of all the available fields
Now this field will be available for you to use in the Pivot Table.
Calculated Fields
Calculated fields (also known as Measures) are calculations that are not
evaluated on a row by row basis; instead they are evaluated on the entire table.
For example, calculating how many units were sold in a region or by quarter
are not row-specific.
Calculated fields are input in the calculation area under the data table.
Once again, I know I’m sounding like a broken record but it important to keep
the big picture in mind. You could mimic calculated columns and calculated
fields directly in Excel...but not for 3 million rows. PowerPivot is for dealing
with extremely large data sets. You can certainly use it for smaller data sets
because it manages data more efficiently than pure Excel. The other reason that
these calculations are important is because the other Excel reporting tools
(Power View and Power Map) need to have the calculations in the Data Model
in order to use them.
Calculated Fields also use DAX formulas. As I mentioned, DAX is new but
similar to Excel formulas. An easy way to see what formulas are available is
to use the PowerPivot DAX formula wizard.
4. Scroll down until you see the COUNTROWS function. Select it.
5. Click OK.
6. In the formula bar, finish the formula so it reads
=COUNTROWS(SalesData).
7. Change the text before the colon to read SalesRecords.
SalesRecords:=COUNTROWS(SalesData)
8. Press Enter.
9. Go into Excel and choose a cell inside the Pivot Table you built.
10. Expand the Sales Data table and you will see the calculated field.
11. Drag the SalesRecords field to the Values area of the Pivot Table.
The Pivot table will now calculate the number of records based on the group
and slicer settings. The SalesRecord calculation in PowerPivot, just gives
you one number, the total number of rows. However, in a Pivot Table the
SalesRecord calculation ‘listens’ to the Pivot Table and recalculates based on
your selections.
You can certainly test it out (and you always should test your calculations). The
Pivot Table says there are two records for Gold Game Confectioners. Double-
click on the 2 or the 43200 to drill down. Excel will pull up the individual
records. You must see two records in the new worksheet to validate the
formula is working.
Pretty cool huh?
TotalSales:=sum(SalesData[Cost])
Would give you the total sales for the entire SalesData table.
KPI
KPI’s are Key Performance Indicators. They are metrics that you design and
they create visual alerts in PowerPivot to call attention to values that are out of
line. In other words, KPI’s work like the Icon Sets in the Excel Data Validation
ribbon.
AvgNetProfit:=AVERAGE([Net Profit])
Note that KPI’s are only available for measures created in PowerPivot. If you
create a calculation in Excel and then include it in PowerPivot, the calculation
will not be available for a KPI to use.
The KPI in the calculation area now has a small icon added to it as an
indicator that there is a KPI associated with it.
Go ahead and change the Pivot Table to see how it can now include the
calculated field and the Status. I changed my Pivot Table around and this is
how it looks:
It has limited the data to only the customers that are in the Northern
Region. Recall that we set up Region as a hierarchy.
It is displaying the Net Profit which was never calculated in Excel; it is a
Calculated Column in PowerPivot.
It has a Calculated Field (AvgNetProfit). AvgNetProfit is calculated for
each customer. (This is very nice. I only created one formula in the
calculation area but I can use it for every customer).
The Avg Net Profit Status KPI appears in the Pivot Table.
Here’s a small test to make sure that the data is flowing through from Excel to
PowerPivot, through the calculated Fields/Calculated Columns/KPI and into
the Pivot table.
3. I’m changing D81 to another number. I’m adding a few zeros to make
it 4125000.
4. Click back on the Pivot Table.
5. Right-click on a Pivot Table cell and Select Refresh.
The Pivot Table values and the KPI should update. If they do, all your data
linkages are working.
Calendar Table
Take a look at the raw data in the SalesData table you’ve been working with.
So far, it has served you well for learning PowerPivot but truthfully, it’s not
enough for meaningful analysis. For example, what if you want to analyze
TotalDiscount by month, or Net Profit by quarter? There is no way to do that in
PowerPivot. PowerPivot doesn’t know what a month is, or what a quarter is.
Remember, you can’t change data in PowerPivot, if it isn’t loaded or
calculated in PowerPivot you are out of luck.
The solution is to create a Calendar Table that stores all the dates in the raw
data and assigns date measures to each record. For example, a Calendar Table
would have every single day (No gaps allowed! Gaps will mess things up!)
in one column and the quarters, months, etc. that the day corresponds to. You
then load the Calendar Table into PowerPivot, set it as a date table and create
a relationship to the SalesData table.
Basically the Calendar Table will have every possible date representation you
will need in your visualizations, year, month, quarter, etc.
By the way, when building a Pivot Table, PowerPivot tries to help you in this
respect. I’m not sure if you noticed but PowerPivot already parsed out the
Invoice Date into Date measures.
If all you are doing is building Pivot Tables and you just need Month, Quarter
and Year, you are all set. However, if you want to use Power Map, Power
View or more date measures, you will need to build a Calendar Table.
The easiest way to build a Calendar Table is to use Excel. List the days in one
column and use the built-in Excel date functions for the rest of the columns. I’m
not going to make you do all that work! I have a basic Calendar Table that you
can use to get you started. Once you have it set up to have what you need, you
just have to import it into each PowerPivot data model you build.
Now you have to tell PowerPivot to treat this table as a Date Table.
12. Select Day as the Date field. (Note that the field must have unique
values).
13. Click OK.
Now you just have to create a relationship between the Calendar Table and the
table that has the data you want to analyze over time (SalesData).
14. In the Design tab, click ‘Create Relationship’.
When you have Date fields you can use a new type of Filter, the Timeline to
control Pivot Tables.
4. Click on InvoiceDate.
5. Click on OK.
Now your users have a much more intuitive way to select a range of dates and
see the related data in a Pivot Table.
Dashboards
Now you can use PowerPivot to manage million and millions of data points.
You create a few calculated columns and a few calculated fields. Then you
have to use a Pivot Table to present your data. Really? Granted, Pivot Tables
are very powerful, they can be augmented with slicers and timelines but you
can’t really make a dashboard with them. You can’t insert rows in the middle
of a pivot table. Formatting is pretty tedious. There must be a better way.
I’m going to show you how to create a dashboard with formulas that can read
data directly from the Data Model...no Pivot Table needed. Think of it as a
VLOOKUP that retrieves data from the Data Model.
Let’s start by creating a simple formula that pulls in SalePrice then you can get
creative and make it more flexible.
You are familiar with tables and table relationships. Those systems are very
good for data storage. For analysis, those systems slow down considerably.
There’s a technology where you can store the data in a multidimensional cube.
Users can pivot the data in the cube to drill down/up to perform analysis. This
is called OLAP (Online Analytical Processing) and the cubes are called OLAP
cubes. A PowerPivot data model is one of these types of cubes; that’s why you
can use the new cube formula to retrieve data from the Data Model.
=CUBEVALUE(connection,member_expression1,...)
Now you can see all the measures in the SalesData tab.
You are going to start by retrieving the NetProfit from the Data Model. This
formula will be the basis of the dashboard.
4. Choose a cell around F12 or so. Type in this formula:
=CUBEVALUE("ThisWorkbookDataModel","[Measures].[Sum of SalePrice]")
This is ok, but you need some more granularity of the data. Let’s change it so
we can see Sum of SalePrice for the Northern Region (remember that the
Northern region is part of the hierarchy you created. Yes, those are still
available to this formula.)
To get sales for the Northern Region, change the formula so it read like this
(You’ll also notice that Excel helps you by displaying the available
fields....very handy):
=CUBEVALUE("ThisWorkbookDataModel","[Measures].[Sum of
SalePrice]","[States].[RegionName].[Northern]")
The rest of this exercise is going to be basically splitting up the above formula
to point to cells with the values instead of hardcoding them inside the formula.
=CUBEVALUE("ThisWorkbookDataModel","[Measures].[Sum of
SalePrice]","[States].[RegionName].["&$C12&"]")
C12 has the region name. Now you have made the formula more flexible.
=CUBEVALUE("ThisWorkbookDataModel","[Measures].[Sum of
SalePrice]","[States].[RegionName].["&$C12&"]","[CalendarTable].[Year].
["&D$11&"]")
8. Drag the formula down and across to fill out the dashboard.
Do you realize how cool this is? Theoretically, you can have multi-million
data rows in PowerPivot and build a dashboard off all that data without ever
using a Pivot Table.
This slicer is now directly connected to the Data Model and will retrieve all
the Products.
Now you are going to connect the Slicer to a cell.
17. Click on the cell right under the label “Sum of Sale Price”. In my
dashboard it is cell C9.
18. Type in this formula:
=CUBERANKEDMEMBER("ThisWorkbookDataModel",Slicer_Product,1)
19. Change the selected product slicer to see the new value reflected in
cell C9.
Note: This trick will not work with multiple slicer selections.
Guess what you are going to do next? Yup, add another member expression to
include Product in the CUBEVALUE function.
21. Drag the formula down and across to fill in the dashboard.
Now as you select a product using the slicer, the CUBEVALUE formula will
read the linked cell and return data from the Data Model.
DAX Formulas
In this lesson, I only briefly touched on DAX formulas. This was by design.
DAX is an enormous topic that really deserves its own lesson.
This was quite the lesson wasn’t it? You are further into the world of Business
Intelligence. This is where Excel is going. Get up to speed with this and you
will be way ahead of everyone else.
I hope I have given you enough of a PowerPivot foundation so that you can
continue learning and developing your skills.
Mastering Excel
Power View
Mark Moore
Copyright © 2016 by Mark Moore. All rights reserved worldwide. No part of
this publication may be replicated, redistributed, or given away in any form
without the prior written consent of the author/publisher or the terms relayed to
you herein.
Introduction
Welcome to another Mastering Excel lesson. If you have previous lessons,
thanks for sticking around. If you are new, I hope you enjoy the lesson. The
lessons are easy going, relaxed, no-nonsense easy to understand. I try my best
to explain complex topics in a simple and entertaining way. My goal is that you
will finish reading each lesson and have immediately applicable skills you can
use at work or home.
What is PowerView?
Microsoft is taking Excel in a new direction. Microsoft has included in Excel
some very powerful tools to help users analyze large volumes of data. This
analysis is usually called Business Intelligence (BI). Previously, processing
and working with these large data sets was limited to experienced technical
professionals that used expensive software packages. Microsoft wants to do
away with that. They want to bring BI to the average user. They use the term
‘Self Service Business Intelligence’ to indicate that users can now perform this
analysis without calling in their IT departments or external consultants.
Microsoft’s toolset is called the Excel BI toolkit. It has several different tools:
Power View
Power View is a new feature of Excel that lets you create graphical analysis
and interactive presentations. Power View is great for data exploration and for
creating presentation where users can interactively drill down into the data.
Power View does not replace PowerPoint. PowerPoint is great for creating a
slideshow with animations, callouts, videos, sounds etc. Data is the main
driver of Power View. You don’t make slides but instead you make interactive
data elements that help you and your users understand the underlying data.
The Data Model you are using is the same one that was built in the Power
Pivot lesson. Power Query and Power Pivot are closely intertwined and later
on in the lesson, you will be going back to Power Pivot for a few exercises
then back to Power View. This is by design. There were a few Power Pivot
topics that I thought were very interesting and cool but I left them out of the
Power Pivot lesson. My reasoning was that in the Power Pivot lesson, I would
have shown you how to do a task in Power Pivot but not show you how to use
it (since it was used in Power View).
I didn’t think that was too useful, showing how to do something without the
why. Since the why is in this Power View lesson I’ll get to show you both, the
how (in Power Pivot) and the why (in Power View).
Silverlight
Power View uses Silverlight, a Microsoft product. If you have the right version
of Excel, you need to also make sure that you have Silverlight installed. Rather
than give you a Microsoft URL that might be invalid in the future, just search
for ‘Install Silverlight’ and go the Microsoft website that appears in the search
results.
Power View should be in the Insert ribbon. The icon looks like this:
If the button is not there (or if it is greyed out), follow these steps to activate it.
In Excel,
1. Go to File.
2. Click on Options.
3. Click on Add-Ins.
4. In the Manage box, select COM Add-ins.
5. Click on Go.
6. Click on the box next to Microsoft Power View from Excel.
7. Click OK.
Excel 2016
For some reason, Microsoft removed the Power View button from the Excel
2016 ribbon. This is how to add it:
1. Click on File.
2. Click on Options.
3. Click on Customize Ribbon.
You are going to add the Power View button. However, buttons need to be
added to Custom Groups. You need to create a Custom Group first. This
example will add a Custom Group to the Insert tab although you can add it to
whichever group you like.
8. You should have both the new group and ‘Insert a Power View Report’
selected. Click on Add.
9. Click on New Group (Custom).
10. Click on Rename.
11. Rename the Group to something more appropriate (MyReports, Power
View, etc.).
The Power View button has been added to the Ribbon in a Custom Group
Tables
Tables are the simplest type of graphic to display in Power View. We will start
with this and then move onto more complex data visualizations.
You will see that Power View built a table based on the SalesData worksheet.
This simple table is a good starting point to explore the various options that
are available in Power View.
When clicking on the table, you will see borders that can be clicked and
dragged to resize the table. When you click inside the table, you will see that a
new Design tab appears. Here you can change the look of the data table.
You will probably need to resize the Cost column, and it’s not obvious how to
do that.
7. Hover the mouse over the column title. When it is highlighted and the
cursor changes to a double arrow, drag the right edge of the title to
resize the column.
Use the scrollbar to move to the bottom of the table. You will see that a nicely
formatted total row has been added for you.
Adding New Fields
Look over to the right of Power View and you’ll see the Power View Fields
pane. (If it is not visible, select Field List from the Power View tab). You can
use this pane to add new fields to the table. There are a few ways to do this.
You can either:
Drag a field from the field list directly to the table
Drag a field down to the field list
Click on the checkbox next to the field which becomes bolded
Reordering Columns
You don’t reorder columns directly in the table; you click and drag the columns
to change the order in the fields list.
Changing the Default Calculation
By default, Power View will apply a sum to all numeric fields. However, this
can be changed to suit your needs. You can click on the small black arrow next
to the field in the Field List to change the aggregation calculation.
Sorting
To sort a column you just need to click on the column header. A small arrow
will appear to indicate that the column has been sorted. One caveat: Once a
table has been sorted you cannot unsort it. You can still sort it based on another
column but you can’t get the table back to the original sort order.
You can rename the Power View sheets just like a normal worksheet. For the
rest of the lesson, you can delete the Power View object (select a cell in the
table and press the Delete key to delete an object) and start anew, or you can
insert a new Power View sheet and keep your previous work. It’s up to you.
Yes, you can even continue to add new objects to the Power View sheet (that’s
what you would do in a real situation) but for this lesson’s purposes, where
possible, I am going to be using a new (blank) Power View sheet.
Matrix Tables
Let me show you about Matrix Tables. (I’m starting in a new Power View
Sheet.)
1. In the field list, click on RegionName, then State Name, then Net
Profit.
You are going to convert this table into a matrix table. (Are you going to take
the Blue pill or the Red pill? Do you want to see how deep this rabbit hole
goes?)
(Ohh come on! You KNEW I was going to talk about that movie at some point!)
2. In the Design ribbon, click on the Table button (If the Design tab is not
visible, click inside the table).
3. Click on Matrix.
The resulting matrix table looks more polished than a plain data table.
Drill Down
If you worked through the Power Pivot lesson, then you should be familiar with
the Excel Data Model. If not, basically, a Data Model is a series of tables that
is imported into Excel. You then build relationships and calculations between
these tables. Pivot Tables and Power View reports can be sourced from the
Data Model.
The States table in this Data Model contains a hierarchy. State Name is a child
of Region Name. You can see this in the matrix table, where Utah and
Washington are children of Pacific.
Optional
If you want to see the Data Model, follow these steps:
4. Click on Central.
5. Click on the arrow to drill down to see the States in the Central
Region.
6. You can click the upwards pointing arrow to go back to the Region
level.
This particular hierarchy only has two levels, Regions and States. If you build
your Data Model with a deeper hierarchy, you can continue to drill down to as
many levels as you include in the Power View Report.
To remove the drill down feature, you can click on the Show Levels button,
and then select ‘Show All Grouping Levels at Once’.
Everything you just did for row drill down is applicable to column drill
downs. All you need to do is click and drag the fields to the column area of the
field list.
Row and Column drill downs are not exclusive. What I mean is that you can
have a Region drill down on the rows and a separate column drill down on the
columns (e.g. maybe you have a time drill down on the columns years to
quarters to months).
Cards
Cards are a new way to visualize data. Let’s see what they look like.
1. Start with the Matrix Table you’ve been working with (or you can
create a new one that looks like the image below).
2. Click on any cell in the Matrix Table to make the Design tab appear.
3. In the Design tab, click on Table, then Card.
The Matrix Table now displays the data with each record in its
own card.
Your card table might look different than mine. That’s because the card change
based on the width of the report. Click on the border handles to change the
card width (cursor changes to a double arrow), to see how the items in it are
rearranged.
Card Styles
You can change the look of the cards by going to Design, Card Style, Callout.
This will make each card much larger. If you resize the larger callout items,
they can be placed as titles or used as pop-outs.
KPI’s can also be shown in Power View. You can display them in Cards,
Matrix Tables, Tables, etc. Since the last exercise dealt with Cards, let’s add a
KPI to the cards.
KPI’s have to be set up in Power Pivot; you cannot set them up directly in
Power View. This is one of those items where the data layer (the Data Model)
does the hard work and the Presentation Layer (Power View) displays the
results elegantly.
The Power View fields pane tends to revert to only show you the fields that
have been used in a report. To add new fields from different tables, you will
need to click the 'All' button.
You can use the Table button in the Design tab to see how the KPI’s are
displayed in Tables and Matrix Tables.
All the standard chart types are supported in Power View: Line, Column, Bar,
Pie, etc. I will show you how to build one or two of these basic charts and then
go on into how to adjust them. I am sure that once you see how to build one
basic chart, you will be able to figure out how to build the others easily.
Resizing Text
With the chart selected, you can increase or decrease the chart font size with
these buttons (in the Design tab). Unfortunately, you cannot specify a font size
in Power View.
By default, the data in a chart is sorted alphabetically. You can change this in
Power View. Hover your mouse over the chart and look at the top left of the
chart. Small notifications appear in that corner.
1. Click on the small grey arrow to sort by the other fields in the chart.
Legend
1. Click and drag the RegionName field over to the Legend box.
You’ll see that each RegionName has been set as the legends and each column
has a different color.
Tile By
Vertical Multiples
Since you have RegionName in the Tile By box, you should see this in the
Vertical Multiples box.
This just means that you can’t drag any new fields from the Data Model into the
Vertical Multiples box.
The Vertical Multiples feature takes each value from RegionName and creates
a chart for each Region.
Horizontal Multiples
Resizing Multiples
For both Vertical and Horizontal Multiple charts, Power View uses a grid
system to place each chart. You can change the default grid to fit more charts
on a page.
1. With the Horizontal Multiples chart selected, click on the Layout tab.
In this tab, you can add chart legends, data labels, etc.
2. Click on Grid Width.
3. Change the Grid Width a few times to see how the charts react.
Note: Grid Width affects Horizontal Multiples only while Grid Height affects
Vertical Multiples.
Now, you can build basic charts and I know you want to move onto more
advanced charting but we can’t. Not just yet. You might not have noticed this
but these charts really aren’t that useful. They don’t really show meaningful
segments of the data. What do I mean? This horizontal multiple chart shows
data for all years. For meaningful analysis, you probably want to narrow down
the data to just one particular year of interest.
Data Filters
Data filters are very important. They let you and your users narrow down the
data set to focus in on smaller segments. For example, looking at one year in a
chart is more useful than only looking at all years lumped together.
Filtering data in Power View works very similar to the regular Excel
Autofilter. You can search for one specific value, select several values, etc.
Even if you haven’t been exposed to Autofilter before, once you see the
interface, you will find it pretty intuitive.
The Data Filter pane is in between the Report pane and the Fields pane. It is
helpfully titled, ‘Filters’. If you don’t see the Filters pane, click on the ‘Filters
Area’ button in the Power View ribbon.
Creating Filters is pretty simple. Let’s build a new report and add a filter to it.
4. Format the numbers so they look more appealing. I applied the number
format with no decimals.
5. Click on an empty area in the report to deselect the table you just
created.
6. Click on ClientName.
7. Click on Status.
8. Resize the objects so you can see the client name (hover over the
column title and drag the edge of the blue box).
There are two types of filters you can apply in Power View: view filters and
object filters.
View filters filter the data for every object in the report. Object filters
filter the data for the object they are applied to.
That’s it. View filters are for everything in the report, object filters are just for
a specific object. Both filters can interact. What I mean is that you can have a
View Filter that excludes France (for example) and then an object that excludes
USA. The object will not show any data for France or USA. As a matter of
fact, the object will never be able to show data from France since the View
filters excludes France. Note: View filters take precedence over object filters.
View Filter
1. Click on an empty part of the report and make sure that the Filters area
only says ‘View’. This is important. If you don’t do this it will mess
up your View filter.
Now you can select one or more regions and both report objects will update to
show only the data segments you chose.
Note: Those numbers you see in the filter box represent the number of those
particular items that are in the underlying data table. This is for informational
purposes only; it does not affect your report.
Advanced Filter Mode - Click on the arrow to open this new pane. Here you
can apply more complex selection criteria.
Erase Filter - The little square (it’s supposed to be an eraser) lets you clear
the filter.
Filters change based on the volume of data and the data type. It does make
dealing with large amounts of data easier.
Search - If the list of items is very large, the filter will include a Search box.
The search box supports the use of wildcards, just like Excel. (‘*’ is used to
represent any number of characters and ‘?’ is used to represent one character)
Numeric Filters
You can also filter by numbers. For example, suppose you only want to look at
customers that have a certain range of profitability. You can drag the field to
the Filter area and set a range.
If you don’t like this range filter, you can click the right pointing arrow and go
into List Filter mode for the filter.
Click the arrow button again and you will get to the Advanced Filter mode.
Yes, three clicks on the same button for three different features.
Dates - The advanced filter for Date fields looks a bit different. You get a nifty
calendar tool to choose the start and end dates.
The only difference is this: when you click on a Power View object, the Filters
pane will have two tabs: View and Table. Any field put into the View tab will
affect all objects in the view. Any filters put in the Table tab will only
affect the currently selected object.
It might happen that as you use Power View you find that you simply cannot
find one data element (i.e. “I KNOW we had sales in the UK, why isn’t this
stupid Power View letting me see them?!?!?”). Before you drive yourself
crazy, go take a look at the View filters. It might be that you filtered out UK at
the view level and then the individual objects can’t show it.
You can add notes and comments to Power View by inserting a text box.
In the Power View ribbon, click on Text Box to insert a text box. You can start
typing your comment. When you are done, the Text ribbon will be available for
you to adjust the appearance of the text.
Slicers
A drawback that filters have is that they are easy to overlook. A user can hide
the Filters pane and not realize that values are being excluded from the
analysis. Slicers are a more obvious way to allow users to narrow down the
data they see in Power View.
1. Create a new Power View report (if you choose to use the existing
report and just delete the objects, make sure you also delete any filters
that were previously set).
2. Click on ClientName and Net Profit.
Now let’s set up a slicer that will let users (and you) limit data by Region
Name.
Table filters supersede view filters. I changed my report so that there are no
view filters. There is a table filter that limits table data to Central, Northern
and Pacific. Notice how the slicer still has the other two regions (Southern &
Western) displayed. You can click on Southern but the table will not show any
data because the table filter has already excluded Southern data.
In summary, view filters supersede all other filters and slicers. Table filters
supersede slicers. Slicers don’t supersede anything.
Advanced Charts
Drill down
4. Enable drill down by clicking ‘Rows - Enable Drill Down One Level
at a Time’.
The table will look like this:
For example, I double clicked on Pacific. Now I see data for Utah &
Washington. You drill back up by clicking the upward pointing arrow at the top
of the chart.
Drill down works for all chart types. Try it out.
Optional Exercise
Play Axis
This feature animates a chart so it shows how data changes over time.
Unfortunately, it does not work for all charts. It works only for scatter and
bubble charts.
If you haven’t been exposed to these types of charts, here is what they do and
look like.
Scatter Charts
Scatter charts show the relationship between two sets of numbers. One
measure is on the x axis and the other is on the y axis.
I created a scatter chart to show the relationship between Net Profit and
Delivery Charge by Product.
Bubble Charts
Bubble charts show the relationship between three sets of numbers. One
measure is on the x axis, the second is on the y axis, the third represents the
size of each bubble. In essence, a bubble chart is a scatter chart except that the
scatter chart dots vary in size.
First, forget about the colors and bubble sizes. Just look at the position of the
bubbles. Net Profit is on the x axis and DeliveryCharge is on the y axis. You
can see the Indigofresh had the highest net profit (because it is on the high end
of the Net Profit axis) and it also had pretty high Delivery Charges (because it
is on the high end of the DeliveryCharge axis).
You can see a general pattern that the higher Net Profit items have higher
Delivery Charges. That’s how you interpret a scatter chart.
Now look at the size of the bubbles. The bubbles represent the Total Discount.
You can see that Indigofresh and Dingeco seem to have about the same Total
Discount (because their bubbles appear to be about the same size) but Stim
Flex has a much lower Total Discount (because its bubble is definitely
smaller). Softtrax and Lexilam seem to have the lowest Total Discounts (their
bubbles seem to be the smallest of all).
How do Net Profit, Delivery Charge and Total Discount vary by Product over
time? In other words, what did this chart look like 3 months ago, 6 months ago,
etc.?
This chart shows everything, all the data in the Data Model. That might be
good to illustrate the animation but not really useful for analysis. This is where
filters help a great deal.
Year is a numeric field and Power View shows the filter in this format.
You can certainly use that if you like, but for me, it is easier to select a single
year if I use the List filter format.
4. If you want to use the List format, click on the List Filter Mode button.
Tile
One more thing; I covered this before but I want to repeat it here in case you
forgot. You can create several identical charts and tables by using the Tile By
box. You can’t use it with Play Axis but you can use it with any other
charts/tables. Let’s do a quick review.
7. Remove the field from Play Axis (click on the arrow and select
‘Remove Field’)
3. Click and drag Product and Cost into the report section to create a
new table.
4. With the new table selected, click on Other Chart, Pie to convert the
table to a pie chart.
5. Resize the pie chart so you can see the slices and product names.
The chart is already set up to be a slicer since it only has one axis. Test it out
by clicking on slice. You will see that the other pie slices are dimmed and the
client table is filtered by product.
This is one feature that probably needs a Text box in your report to instruct
your users of this ability. There is no obvious indication that this ability is
included in the report.
Continue working with the current Power View report. You should have a pie
chart (Cost by Product) and a table (ClientName and DeliveryCharge)
1. Make sure nothing is being filtered (click on the pie slice to show all
data).
2. Click and drag State Name to the report section.
3. Click on Net Profit.
You should have a new table that shows Net Profit by State
What happened? The Client chart was filtered to show only delivery charges
related to the product selected. The column chart also changed. I clicked on the
Dingeco slice and my column chart looks like this:
The column chart now shows the Dingeco data in a solid color (because that
was the pie slice I clicked on) and the total bar in a lighter color. The two
colors are a visual representation of the proportion of Dingeco to the total on a
per State basis.
The Client table will show only clients in Utah and the pie chart looks all
funky.
The same color logic applies here. The solid colors represent the proportion
of Utah sales by product to the total.
Please keep this in mind, even though I am showing you each feature one by
one, they do not need to be used in isolation. The previous exercise shows how
you can mix in all the Power View features.
Power View is just presenting the data in the Data Model. You can’t break
anything in the data. Mix up all the features, poke around, play with it until you
get the right dashboard or analysis you need. If you mess up a chart, delete it.
Recreate that one again until you get it right.
Images
Now we are going to review how to add images to Power View reports. One
item to keep in mind is that Power View will only accept two kinds of image
file types: jpeg and png. If you have another file type, you must use Save As
either of these two types in your image processing software.
Background Images
You can add a background image to your Power View report by clicking the
Set Image button and then browsing to the image you want to use.
You can also change the transparency of the image by clicking the
Transparency button.
If you have several images in a report, you can have one in front of the other by
right clicking on the image and choosing ‘Bring to Front’ or ‘Send to Back’
Data bound images are images that are imported into the data model itself.
They are stored there and can be used in Power View. In order to get this to
work, you are going to go back into Power Query and work with a new query.
Then you are going to learn how to use these images in slicers, filters and
cards.
For this lesson, I just created some images with the product names in a
different font. Yeah, they are ugly but I want to avoid any legal issues.
The first thing you have to do is get the images from your PC into the data
model. You are going to use Power Query for this. You have to use Power
Query. Power View does not change data, it only presents it. Power Pivot does
not change data; it only manages relationships and does calculations. Power
Query does change data and imports it into the data model.
Note: I am using Excel 2016. If you are using a different version of Excel
opening Power Query might be a bit different.
You are going to import all the images from the Images folder (these images
were included in the email with the follow-along workbook).
4. Click OK.
5. Click CTRL and select both the Content and Name fields.
These are the only two fields that we need. Let’s get rid of the rest of them.
You need to build a relationship between the ProductID in the Product table to
our Images table. The image names contain the correct ID. You are going to
create a calculated column in Power Query that will extract the ID from the
name.
You will need to do something similar for all images you load into Power
Query. You can rename the files with the ID or you can build a lookup table
that has ImageName in one field and ID in the other. Then you can import that
new table and use that as a lookup. The thing you cannot do is type in
numbers (the IDs) directly into Power Query.
7. Click on ‘Add Custom Column’ in the ‘Add Column’ tab.
Text.Range([Name],Text.PositionOf([Name], "_")+1,1)
13. In the Power Query Home tab, select ‘Close & Load To...’
14. Select ‘Only Create Connection’ and ‘Add this data to the Data
Model’.
The important part is the ‘Add this data to the Data Model’. You don’t really
need to load the data into a worksheet, you just want it in the data model. If you
do load it into the worksheet it’s not a big deal, it’s just an extra worksheet you
don’t need.
Important Note:
I think I found a bug. I have a pretty powerful computer and I kept getting an
error saying that there was not enough memory and that I should use 64-bit
Excel. My computer definitely has enough memory for this exercise. I had to
close Excel completely and restart this exercise in order to get ‘Load’ to work.
19. Change the values in the Table Behavior box so they match this image.
20. Click OK.
Now you need to establish a relationship between the newly imported Images
table and the existing Product table.
22. Click and drag ImageID from the Images table to ProductID in the
Sales Data table.
23. Close PowerPivot.
24. Save the workbook (I don’t want you losing all this work!).
Clicking on the different images will filter the data in the other table.
Optional
29. Right click on the Slicer and select Cut to get rid of it.
30. Click any cell inside the table to select it.
31. Click and Drag ‘Content’ from the Images table to the ‘Tile By’ box.
Now you can use the images to scroll through each tile.
Default Labels
Each image in the Tile By box has the file name there. This is because in
PowerPivot, you set the filename as the default label in the Table Behavior
window.
You can go back to Power Pivot and select a different column as the default
label. If you select [No Column] numbers will appear in the Tile By box. If you
put a blank in a new Power Query column, the tiles show (Blank). I don’t think
you can have an empty Default Label.
• Products
• Regions
• States
• Employees
• Salespeople
• Customer Logos
• and so on…
Mapping Data
You can also use Power View to present geographical data in a map. Maps in
Power View use Bing maps, so you will need to have Internet connectivity if
you want to use this feature.
Also, Power View tries its best to determine if a field is geographical or not.
In some cases, you will need to go back into Power Pivot and set the data type
as the appropriate type. This is where you do that in Power Pivot:
Can you image how impressed people are going to be with the interactive and
animated charts you can build? I think you’re gonna get a promotion out of this!
:-)
Mastering Excel
Power Map
Mark Moore
Copyright © 2016 by Mark Moore. All rights reserved worldwide. No part of
this publication may be replicated, redistributed, or given away in any form
without the prior written consent of the author/publisher or the terms relayed to
you herein.
What is Power Map?
Microsoft is taking Excel in a new direction. Microsoft has included in Excel
some very powerful tools to help users analyze large volumes of data. This
analysis is usually called Business Intelligence (BI). Previously, processing
and working with these large data sets was limited to experienced technical
professionals that used expensive software packages. Microsoft wants to do
away with that. They want to bring BI to the average user. They use the term
‘Self Service Business Intelligence’ to indicate that users can now perform this
analysis without calling in the IT departments or external consultants.
Microsoft’s toolset is called the Excel BI toolkit. It has several different tools:
Power Map
Power Map is a mapping tool that can take data from the Excel Data Model or
directly from a spreadsheet and present it on a map. If you have gone through
the previous lessons on Power View, you might be wondering why Power Map
exists at all since you can add maps in Power View. Power View can add
maps and other visualizations in a report. Power View-based maps also
benefit from the powerful filtering capabilities in Power View. However,
Power Map does have many features that Power View-based maps do not. I
will go through all the Power Map features and by the end of this lesson you’ll
know when you will need to use which mapping utility.
Installing Power Map
Excel 2013
Power Map comes installed with Office 365 Pro and Excel 2016. For Office
2013, you will need to download and install the Power Map add in.
As of this writing, the URL to download Power Map for Excel 2013 is:
https://support.office.com/en-us/article/Power-Map-for-Excel-82d65bd7-
70c9-48a3-8356-6b0e82472d74
This URL will probably change in the future. To look for the addin, search for
the terms ‘Power Map Excel 2013’ and you should find the correct webpage.
The Power Map add-in will work for all the following versions of Excel
2013:
In this version of Excel, Microsoft has renamed Power Map to 3D Maps. The
button is in the Insert ribbon.
Excel 2013 vs Excel 2016 Differences
I’ll start off here by apologizing. The Excel 2016 Power Map interface is
slightly different than the Excel 2013 version. For example, when adding a
new map, Excel 2013 has a three or four step wizard that asks for certain
information. Excel 2016 does not have that interface and instead has one pane
where you make all your choices.
I’m using Excel 2016 and I don’t have a copy of Excel 2013 available. If you
are using Excel 2013, some images in the lesson will not match with your
system. I’m sorry for the inconvenience and I totally get that it might frustrate
you not being able to follow the lesson exactly.
Rest assured that you can absolutely do everything in Excel 2013 that I am
going to show you, it’s just that you might need to click a few more buttons to
get there.
Data Connectivity
Power Map uses Bing maps to render its images. To use Power Map, you will
need to allow Excel to connect to the Internet and use Bing Maps. Keep this in
mind when working behind a corporate firewall. If Power Maps does not
display data, you may have to contact your IT department.
Data Sources
Power Map can use data directly from Excel or from the Excel Data model.
For this lesson Power Map will use data from the Data Model.
Region Maps
Let’s just start working with Power Map. Not much theory in this lesson. Lots
of hands-on time and you’ll get how the product works pretty easily.
Power Map will show data by Country, City or State. Let’s see what that
region maps looks like.
If you’re using Excel 2013, it will not be 3D Map. Power Map will be here:
4. Click and drag the Country field from the Field List to the Location
box (Excel 2013: ‘Geography and Map Level’ box).
There are five types of maps that Power Map supports.
Stacked Column
Clustered Column
Bubble
Heat Map
Region
You change the map type by clicking these buttons in the Layer pane. The
default map type is a stacked column.
You will see each region’s cumulative Net Profit represented by color.
If you hover over a data point, you’ll see a pop-up window showing detailed
data on that particular country.
7. Click and drag the ‘Product Category’ field from the field list to the
Category box.
8. Change the map type to Clustered Column.
Now, this is starting to look pretty cool. You can see column charts for each
country.
9. Test out these arrows in the bottom right of the map. They don’t do
what you think they do!
The up and down arrows change the pitch of the map. The left and right arrows
change the rotation of the map. You can use the + and - to zoom in and out in
the map. You can also use the mouse scroll wheel to zoom.
Note: The reason the bubble chart shows pie charts is because you have a
field in the Category box. If you remove that field, the map will turn into a
bubble chart (with solid color circles representing Net Profit)
Notice that the Layers pane changed a bit when you changed the chart type to
Bubble. The ‘Height’ box now reads ‘Size’. This pane will change based on
the chart type selected.
This change is subtle but it does matter? Why size? Size of what? The slices
represent the Product Categories so what does this size attribute do?
The Size attribute represents the size of the circle. Larger circles represent a
larger country Net Profit. You can see at a glance which countries had the
greatest Net Profit by comparing pie size. When you find the country of
interest, you can then focus on the pie slices to see the breakdown.
Pretty neat. This chart conveys a lot of information with just a few images.
Map Properties
Let’s work with the map properties to improve it.
2. Use the scrollbar to change the size of the pies so they don’t overlap
in the map.
Filters
Power Map can also filter that data displayed on the map. Let’s suppose that
you are only interested in seeing data related to products in the Health and
Home category (you need to exclude Electronics).
6. Hover the mouse pointer over any data point in the map.
7. Click on the small cog in the upper right corner to open the Card
Editor.
You can do a lot of stuff here to customize a card. I’m going to list them here
and you can play around with them as much as you want.
You can add fields to the card (and not add them to the map) by clicking
the ‘Add Field’ button
Click and drag the fields to change their order
Change the field name by clicking the pencil icon
Change the field aggregation method by clicking Sigma
If you completely mess up the card appearance, click the ‘Reset to Defaults’
button to undo all your changes and start over.
Notice that you can also hide layers by clicking the eye icon.
2. Click the ‘Add Layer’ button (this might be different for you if you are
using Excel 2013).
You will now have a column chart combined with the previous pie charts. It
doesn’t look that great.
6. Change the map type to Region.
Now the maps look a bit better. You can still see all the following:
The filter you applied in the Net Profit layer is applied to this new layer.
Notice how Electronics is not shown in the map.
Mapping Confidence
Power Map can use latitude, longitude, zip codes, country names, city names
and even custom names to show geographic data. You need to be careful with
data that is not precise. For example, suppose you have a date set that has
Paris. Power Map will not know if you mean Paris, Texas or Paris, France. In
this case, you will need to add another field to further define the geographical
data. In this case, you can add a State or Country field and then add it to the
Location box.
Power Map lets you know where it ran into trouble. As you work through the
lesson you can see how confident Power Map is on its mapping guesses.
If 96% accuracy is good enough, then you don’t have to worry about the 4%
errors. However, if you need greater accuracy, then you need to use this report
as a starting point.
The red x’s mean Bing maps doesn’t have shape icons for these countries. You
can’t fix this directly in Power Map. You will need to go into the source data
and try another name, add a longitude and latitude or add a zip code to see if
Bing can retrieve the right country shape (if it has it available).
The Yellow warning icons indicate that Bing took its best guess. The data had
‘East Timor’ and Bing chose ‘Timor-Leste’.
2D Charts
Sometimes a geographical map can be enhanced by a standard chart. For
example, consider trying to look for the country with the highest number of
units sold. You would have to move along the world map looking for the
country. In these cases, using a 2D map will make searching (and visualizing
data) easier.
Let’s add a 2D map to the Units Sold layer. (Hint: It’s pretty easy).
3. Click Insert.
4. Drag the chart to one corner of the map.
This map has a few useful features.
You can change the map type by clicking on the map button in the top
right of the map (you have to have the mouse pointer over the map for it
to appear)
You can see the Bottom 100 locations by clicking the ‘Top 100
Locations’ title
If the map had multiple values, you could select another one by clicking
‘UnitsSold (Sum)’
Hovering over a column displays that country’s data card
You will learn to bring to the table win-win survival strategies to ensure
proactive domination. At the end of the day, going forward, a new normal that
has evolved from generation X is on the runway heading towards a streamlined
cloud solution. User-generated content in real-time will have multiple
touchpoints for offshoring.
Awesome right?
HAHAHAHAHAHAHAHA!
I’m just messin’ with ya. That was a bunch of corporate nonsense I put in there
to see if you were paying attention.
Back to timelines.
Power Map can display data as it changes over time. All you need is a field
with a time measure in it.
1. In Power Map, click on File, Close. You won’t lose the current map; it
will be included in the Excel file.
Look at the data in Excel. Excel put a handy message box letting you know
there is a map of the data.
9. Click the Play button to see how data changes over time.
You can zoom is and move around the map while the animation plays.
Timeline Options
You can change how the timeline behaves by changing its properties.
Let’s build a movie using the last exercise that had a chart with the timeline
added.
1. Add a new scene by clicking the ‘New Scene’ button (2013: ‘Add
Scene’ button).
2. Select Copy Scene 1.
Create Video
Creating a video is a matter of a few clicks.
Custom Maps
You can extend Power Map’s functionality by using custom maps. These maps
don’t even have to be geographic. Suppose you have a picture of a widget your
company produces. You also have a data set from the Engineering department
that shows where the major failure points were in testing. You can use Power
Map to show that data graphically.
Let’s see how that works. I’ll supply the product image and you’ll make up the
data.
Now we need to create data that is correlated to the image. You are going to
record the x and y coordinates of the failure points.
3. Open widget.jpg in Microsoft Paint (This file came along with the
Excel workbooks).
4. Hover your mouse icon over any spot on the widget. Paint will how
you the x and y coordinates in the bottom left of the window.
5. Record the coordinates in Excel.
This is what mine looks like. Yours will be completely different. That’s ok.
7. Close Paint.
8. Click on any cell in the sample data.
9. After launching Power Maps, click on 3D Maps to insert a new map.
10. Click on New Scene, New Custom Map.
A new drop down with the words ‘Select One...’ will appear. You need to tell
Power Map what these fields are.
17. Set x as the X Coordinate and y as the Y Coordinate.
18. Drag the field ‘Times failed’ to the Height box.
19. You’ll get a bar chart for each failure point. For this exercise, that’s
not the best visualization.
20. Change the chart type to Heat Map.
This is a better visualization. Now you can see where the product has had the
most problems.
Your use of Power Map is really just limited to your imagination and the
availability of data. With these custom maps you can track all kinds of stuff.
Here are a few examples I can think of:
With a web page as a map, you can track where people click the most
Using a warehouse floor plan and accident data, you can see where the
most accidents happen
Track throughput on an assembly line
You’ve learned all the complex parts of Power Map. I didn’t cover some items
because I am certain you can figure them out; adding text boxes, changing the
background, using themes, etc.
One last thing, I used countries in this lesson. You can get much more granular
than this. Power Maps will interpret countries, zip codes, latitude and
longitude values, even street addresses. If you have that level of detail, try it
out.
If this lesson has helped you, please take a few minutes and leave a review on
Amazon. The more reviews the lesson gets, the easier other students will be
able to find it.
Thank you!