Data Analysis (Excel Pivot Table)[en]
Data Analysis (Excel Pivot Table)[en]
[Document subtitle]
i
TABLE OF CONTENTS
CHAPTER PAGE
CHAPTER 1 PIVOTTABLE 101 1
1.1 Structuring Source Data 2
1.1.1 Data Table Structure 2
1.1.2 Correct Data Table Structure 3
1.1.3 How to create a Pivot Table? 3
1.2 Navigating the Field List 7
1.2.1 Pivot Table Field List 7
1.2.2 How to modify your Pivot Table field list? 7
1.3 Creating and Manipulating Table 9
CHAPTER 5 EXERCISES 51
5.1 Tutorial 1: Converting Source Data for a Pivot Table 51
5.2 Tutorial 2: Creating a Pivot Table 52
5.3 Tutorial 3: Creating Multiple Types of PivotTable Information 53
5.4 Tutorial 4: Creating PivotTable Charts 56
5.5 Tutorial 5: Creating Simple Dashboard 57
Data Analysis With Excel Pivot Table 1
- CHAPTER 1 -
PIVOTTABLE 101
Objectives:
PivotTable is an interactive way to quickly summarize large amounts of data, you can use a
PivotTable to:
• Analyze numerical data in detail
• Answers unanticipated questions about your data
In the original report format, the page and column headers are used to describe multiple
values (data point)
Use the top row or the top column to categorise your values.
For example, to create “Excel table for blog post performance data”, you need to have "URL
listing”, "Post Title", "Views to Date," and “Publish Date” information.
You can sort the alphabetical order, cell values, URL, Post title, publish date or others
information you need.
Data Analysis With Excel Pivot Table 5
For example, if you want to sort the “number of views” data. Under the Sort by, you can choose
“Views to Date” option and set the order to “Smallest to Largest”. Then, click “OK”.
This will open the Create PivotTable dialog box, you can choose where you want the Pivotable
report to be placed. After you select the “New Worksheet”, click "OK."
Figure 1.9: Choose where you want to put the Pivot Table
Data Analysis With Excel Pivot Table 7
Step 3: If the PivotTable Field List pane does not appear, go to “Analyze” tab and then click
the “Field List” Button.
Original Report
ABC Co.
EMEA Region
For example (Table 1.1), the sales data table contains all sales amounts in the [Sales $]
column. With this format you could easily sum the column to produce the Total Sales $ for all
companies, regions, products, and months. You could then start filtering the columns to see
only the sales for one month and one region. A pivot table works the same way, and basically
filters your table based on criteria you specify in the filter fields.
The basic rule of the data structure is that all values of the same type need to be in one column.
This one rule should hopefully make it easier to quickly determine if your data is in the right
structure. If the data you are trying to analyze is spread out over multiple columns, then you
will likely need to convert it before creating a pivot table. In the “Original Report” above, the
Sales $ are in multiple columns by month (Jan – Apr). This one observation tells us that the data
is in the wrong structure.
Data Analysis With Excel Pivot Table 10
You can import or connect to external data, and then shape that data, for example remove
a column, change a data type, or merge tables, in ways that meet your needs. Then, you can
load your query into Excel to create charts and reports. Periodically, you can refresh the data
to make it up-to-date.
STEP 1: Highlight your data, go to “Insert” tab and click Table button.
STEP 2: Go to Data tab > Get & Transform Data, click on From Table/Range button.
STEP 3: The Power Query Editor windows will pop-up. Highlight the data that you want to merge
into one column. For example, highlight the Apple column until Tea column.
STEP 4: From the Power Query Editor, go to” Transform” tab and click on Unpivot Column button
to merge the data into one column.
STEP 5: To close Power Query Editor, go to Home tab and click Close & Load.
- CHAPTER 2 -
PIVOTTABLE FORMATTING
Objectives:
In Excel, you can use conditional formatting to highlight cells, based on a set of rules. For
example, highlight the cells that are above average, or lower than a specific amount. After
applying conditional formatting to a pivot table, adjust the settings, to make sure that the
correct cells are formatted, after the pivot table is refreshed.
BEFORE
AFTER
STEP 6: On the bottom right of the selected data set, you can see the Formatting Options icon:
STEP 7: Click on that formatting option icon, it will show the drop-down list of:
• Selected Cells (which would be selected by default)
• All cells showing “sum of Revenue” values
• All cells showing “sum of revenue” values for “date” and “store”
Now when you add any data in the back end and refresh the pivot table, the additional data
would automatically be covered by conditional formatting.
BEFORE AFTER
STEP 4: Click OK. This will apply the conditional formatting to the selected cells
STEP 5: Go to “Home” tab, click on Conditional Formatting button, then click Manage Rules
STEP 6: In Conditional Formatting Rules Managers, select the rule you want to edit
STEP 7: Click Edit Rule button
STEP 8: From the Edit Formatting Rule windows, you will see three options:
• Selected Cells
• All cells showing “sum of Revenue” values
• All cells showing “sum of revenue” values for “date” and “store”
This will apply the conditional formatting to all the cells for ‘Date’ and ‘Store’ fields. Even if you
change the backend data (add more store data or date data), the conditional formatting
would be functional.
Data Analysis With Excel Pivot Table 21
Subtotals
• Subtotals
o In Compact Form, Subtotals can be shown
at the top or bottom of each group.
o This setting affects all the Row fields.
o For Column fields, Grand Total are always
shown at the Bottom.
o The Row Label remains at the top, even if
Subtotals are at the bottom.
Data Analysis With Excel Pivot Table 22
Row Labels
• In Outline Form, each Row Label is in a separate row.
• The Row Label is always above the labels for the inner fields.
• The Row Labels can be repeated.
Row Fields
• In Outline Form, each Row field is in a separate column.
• Each Row Fields shows its name in the column heading.
Subtotals
• In Outline Form, Subtotals can be shown at the Top or Bottom of each group.
• This setting effects all the Row fields
• For Column Fields, Grand Totals are always shown at the Bottom
• The Row Label remains at the top, even if Subtotals are at the Bottom
Data Analysis With Excel Pivot Table 23
The Tabular Form layout may be useful when you want to show all the field names as heading
labels and want to reduce the number of rows.
Row Labels
• In Tabular Form, Row labels for the outer fields are on the same row as the first label for
the related inner fields.
• The Row labels can be repeated.
Row Fields
• In Tabular Form, each Row field is in a separate column.
• Each Row field shows its name in the column heading.
Subtotals
• In Tabular Form, Subtotals can only be shown at the Bottom of each group.
• This setting affects all the Row fields.
• For Column fields, Grand Totals are always shown at the Bottom.
Data Analysis With Excel Pivot Table 24
- CHAPTER 3 -
SORTING, FILTERING & GROUPING
Objectives:
• Learn how to use sorting, filtering and grouping tools in pivot table
• Learn how to sort data
• Learn how to add wildcards
• Learn how to group data
Search box
Check box to
hide/show
pivot item
There are three types of filters that can be used in pivot table:
Label Filters
These filters allow you to filter relevant
data based on the field items (such as
filter specific item or item that contains a
specific text) or the values (such as filter
top 10 items by value or items with a
value greater than/less than a specified
value).
Value Filters
You can filter items based on the
values in the columns in the values
area.
Wildcards can take place of any character and the two wildcards that you can use while
filtering text in Pivot Table is:
• Asterisk (*) – to represent any series of characters
• Questions marks (?) – to represent any single characters
- CHAPTER 4 -
CALCULATED FIELDS & VALUES
Objectives:
A Pivot Table is used to summarise, sort, reorganise, group, count, total or average data stored
in a table. It allows us to transform columns into rows and rows into columns. It allows grouping
by any field (column), and using advanced calculations on them.
When using a pivot table your source data will need to be in a tabular format. This means your
data is in a table with rows and columns.
• The first row should contain your column headings which describes the data directly
below in that column. There should be no blank column headings in your data.
• Each row after the column headings should pertain to exactly one record in your data.
For example, if your table contains customer data then each row might have the
name, street address, postal code and email address for exactly one customer.
Data Analysis With Excel Pivot Table 32
Figure 4.3: Analyze > Fields, Items & Sets > Calculated Items
STEP 5: In the Name box, you can give your fields a name “Laptop Bag Sold”.
In this step, we are going to create a simple calculation that sum all the items related to Laptop
Bag.
STEP 6: Select the item one by one and separate them with + sign.
STEP 7: Click ADD
STEP 8: Click OK
To hide any items, you can deselect the options you want to hide.
Result:
4.2.1 SUM
Consider the following PivotTable wherein you have the summarized sales data region wise,
salesperson-wise and month-wise
As you can observe, when you drag the field Order Amount to ∑ VALUES area, it is displayed
as Sum of Order Amount, indicating the calculation is taken as Sum. In the PivotTable, in the
top-left corner, Sum of Order Amount is displayed. Further, Grand Total column and Grand
Total row are displayed for subtotals field-wise in rows and columns respectively.
Data Analysis With Excel Pivot Table 37
As you can observe, Sum of Order Amount in the top-left corner of the PivotTable and in the
∑ VALUES area in the PivotTable Fields pane is changed to the new Custom Name - % of
Grand Total.
Figure 4.12: The "% of Grand Total" appear on the column label.
Data Analysis With Excel Pivot Table 40
Figure 4.14: The "% of Row Total" appear on the column label.
Data Analysis With Excel Pivot Table 41
4.2.6 Count
Suppose you want to summarize the values by the number of Accounts region wise,
salesperson wise and month wise.
4.2.7 Average
Suppose you want to summarize the PivotTable by average values of Order Amount region
wise, salesperson wise and month wise.
Figure 4.18: Show the result after apply summarizing value by average
You have to set the number format of the values in the PivotTable to make it more presentable.
Figure 4.20: Format Cells to set the Number category to 2 decimal places
Data Analysis With Excel Pivot Table 44
STEP 11: Type 2 in the Decimal places box and click OK.
The PivotTable values will be formatted to numbers with two decimal places.
Figure 4.20: Result after summarize the values by using Average with two decimal places
4.2.8 Max
Suppose you want to summarize the PivotTable by the maximum values of Order Amount
region-wise, salesperson-wise and month-wise.
The PivotTable will display the maximum values region wise, salesperson wise and month
wise.
STEP 4: Click on the header the Grand Total column.
STEP 5: Type Max Order Amount in the formula bar. Both the Column and Row headers will
change to Max Order Amount.
4.2.9 Min
Suppose you want to summarize the PivotTable by the minimum values of Order Amount region
wise, salesperson wise and month wise.
This pivot table shows coffee product sales by month for the imaginary business that you own
and operate. Suppose, however, that you want to add a calculated value to this pivot table
that shows the difference between two months' sales. You may do this so that you easily see
large changes between two months' sales. Perhaps this data can help you identify new
problems or important opportunities.
STEP 2: Put your cursor anywhere inside the PivotTable field to activate it.
Figure 4.28: Analyze > Fields, Items & Sets > Calculated Field
STEP 5: In the calculation area, click Fields, Items & Sets and select Calculated Fields.
Data Analysis With Excel Pivot Table 49
STEP 6: The Insert Calculated Field windows will pop-up. In the name box, type “Tax”.
Field Name
Custom
Formula
STEP 7: In the Formula box, type in your tax formula. For example, “=IF (Qty > 100000, 3%* Qty,
0)”.
STEP 8: Click Add.
Figure 4.31: The new fields (Tax) appear in Pivot table (new column) and also appear in PivotTable Fields
box
Data Analysis With Excel Pivot Table 51
- CHAPTER 5 -
EXERCISES
Answers:
Note: Name your sheets follow the above three PivotTable information and set the Format
Number to 2 decimal and use 1000 separator (,)
Answers:
1. Sales by Categories & Chain
Data Analysis With Excel Pivot Table 54
1. Bar PivotChart
- Display Sales by Categories Chain & Sales by Managers Chain from different
states
2. Line PivotChart for displaying
- Display Sales by Chain follow by months & years
Answers:
Data Analysis With Excel Pivot Table 57
Task:
• Remove the filter button on each chart
• Element: Add a PivotTable Slicers
• New PivotTable Charts:
1. Pie PivotTable Charts to display only the “Sales of Chain”.
2. Sparkline Pivot to display “All Chains Sales Total and Trend by State”
3. Map Charts to display the “Sales follow by the Country State”
• Add graphic
Answer: