0% found this document useful (0 votes)
15 views68 pages

DV Unit - VI Notes

This document provides a comprehensive guide on Pivot Tables in Excel, detailing their creation, features, and how to manipulate data for analysis. It explains the process of summarizing large datasets, creating reports, and updating Pivot Tables with new data. Additionally, it covers sorting options and manual arrangements to enhance data presentation and insights.

Uploaded by

siddhardhakavuru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views68 pages

DV Unit - VI Notes

This document provides a comprehensive guide on Pivot Tables in Excel, detailing their creation, features, and how to manipulate data for analysis. It explains the process of summarizing large datasets, creating reports, and updating Pivot Tables with new data. Additionally, it covers sorting options and manual arrangements to enhance data presentation and insights.

Uploaded by

siddhardhakavuru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 68

DATA VISUALIZATION

Chapter-4 Pivot Tables


Introduction to Pivot table

A Pivot Table is an extremely powerful tool that you can use to slice and dice data. You can
track and analyze hundreds of thousands of data points with a compact table that can be
changed dynamically to enable you to find the different perspectives of the data. It is a simple
tool to use, yet powerful.
The major features of a PivotTable are as follows −

 Creating a PivotTable is extremely simple and fast


 Enabling churning of data instantly by simple dragging of fields, sorting and filtering
and different calculations on the data.
 Arriving at the suitable representation for your data as you gain insights into it.
 Ability to create reports on the fly.
 Producing multiple reports from the same PivotTable in a matter of seconds.
 Providing interactive reports to synchronize with the audience.
Creating a PivotTable
You can create a PivotTable from a range of data or an Excel table. You can start with an empty
PivotTable to fill in the details, if you are aware of what you are looking for. You can also make
use of Excel Recommended PivotTables that can give you heads up on the PivotTable layouts
that are best suited for summarizing your data.
Excel gives you a more powerful way of creating a PivotTable from multiple tables, different
data sources, and external data sources. It is named as PowerPivot that works on its database
known as Data Model.
PivotTable Layout - Fields and Areas
The PivotTable layout simply depends on what fields you have selected for the report and
how you have arranged them in Areas. The selection and arrangement can be done by just
dragging the fields. As you drag the fields, the PivotTable layout keeps the changing and it
happens in a matter of seconds.
Exploring Data with PivotTable
The primary goal of using a PivotTable normally is to explore the data to extract significant
and required information. You have several options to do this that include Sorting, Filtering,
Nesting, Collapsing and Expanding, Grouping and Ungrouping, etc.
Summarizing Values

G. Amulya, Assistant Professor, CSE 1


Once you collate the data required by you by the different exploration techniques, the next
step that you would like to take is to summarize the data. Excel provides you with a variety of
calculation types that you can apply based on suitability and requirement. You can also switch
across different calculation types and view the results in a matter of seconds.
Updating a PivotTable
Once you have explored the data and summarized it, you need not repeat the exercise if and
when the source data gets updated. You can refresh the PivotTable so that it reflects the
changes in the source data.
PivotTable Reports
After exploring and summarizing the data with a PivotTable, you would be presenting it as a
report. PivotTable reports are interactive in nature, with the specialty that even a person not
familiar with Excel can use them intuitively. Because of their inherent dynamic nature, they
will enable you to change the perspective quickly of the report to show the required level of
detail or to focus on the specific items in which the audience expresses interest.

Creating a Pivot table and summarizing the pivot table

A Pivot Table in Excel summarizes large amounts of data by organizing the data into small
conclusive tables. Pivot Tables can help create reports and charts to understand trends. It also
allows data filters to view just the details for areas of interest and explore more by changing
the parameters.
It is known as a Pivot Table as it lets the user rearrange the rows and columns around the data
to arrive at the desired summary. Users can also view total sales for different products, show
product sales in percentages, get employee headcount in different departments, etc.
For example, when we create Pivot Table for the data below,

G. Amulya, Assistant Professor, CSE 2


The data is organized in the below form:

Key Highlights
 Pivot Table in Excel helps group complex data in multiple ways to draw meaningful
conclusions easily.
 We can rotate the data in the large data set to view it from different perspectives.
 We cannot add, subtract or modify data while creating a Pivot Table.

G. Amulya, Assistant Professor, CSE 3


 We can use Pivot Tables for creating custom reports with appropriate formatting.

How to Create a Pivot Table in Excel?


Example #1
The table below shows a list of auditors with the properties they marked as correct and
incorrect. We want to count the properties according to their status using the Pivot Table.

Solution:
Step 1: Select the data table and click on the Insert menu
Step 2: Click on Pivot Table

G. Amulya, Assistant Professor, CSE 4


A dialogue box PivotTable from table or range is displayed as shown below

Explanation:
Table/Range is the selected data table.
Next, we have to select whether we want the Pivot table in the New Worksheet or the Existing
Worksheet.
Here, we select the Existing Worksheet.
Now, we have to specify the location (cell) for the Pivot Table. For this, click the desired cell
and it will be displayed in the Location option in the dialogue box.
Now, click OK and the below Pivot Table will be created.

G. Amulya, Assistant Professor, CSE 5


The above Pivot Table has no data. To enter data into it click anywhere on the Pivot table and
we can see a Pivot Table Fields pane on the right side of the Excel Window as shown below

G. Amulya, Assistant Professor, CSE 6


At the top, the Pivot Table has a list of fields (columns of the data table). At the bottom of
the Pivot Table Fields pane, there are four areas (Rows, Values, Filters, and Columns) in
which we need to place the data fields.
 Rows: Data that is taken as a specifier
 Values: Count of the data
 Filters: Filters to select the desired data field
 Columns: Values under different conditions
We can place the data fields into the desired area either by dragging them or by clicking the
checkbox next to the data field.
Step 3: Drag the Auditor field to the area Rows, Property_ID to Values, and Status to Filters.

It results in the below table

G. Amulya, Assistant Professor, CSE 7


The table shows the Total count (17) of the Property_IDs checked by the auditors.
Now, we want to count the number of Property_IDs marked as Correct
Step 3: Click on the Filter section dropdown in the table

Step 4: Click on the Correct checkbox > Select Multiple Items > OK

The result is displayed as shown below

The above table shows the total number of Property IDs marked as correct to be 13.
Step 4: Select the Incorrect option from the filter (dropdown) to get the below result

G. Amulya, Assistant Professor, CSE 8


The above table shows the total count of Incorrect Property IDs.
Example #2
The table below shows sales of Product 1, Product 2, Product 3, Product 4, Product 5, Product
6, Product 7, Product 8, and Product 9 in the year 2017 in quarters- Q1, Q2, Q3, and Q4. We
want to find the total sales of all the products using the Pivot Table.

Solution:
Here, we will use the alternative method to create the Pivot table. For that,
Step 1: Press the keys ALT + D + P on the keyboard

G. Amulya, Assistant Professor, CSE 9


The PivotTable and PivotChart Wizard dialogue box opens up. It asks two questions-
1. Where is the data you want to analyze?
2. What kind of report do you want to create?
Step 2: Select the first option for both questions, i.e.,
1. Microsoft Excel list or database and
2. PivotTable
And click Next.

Note: By default, the first options for both questions are selected.
Now, Excel asks for a range of data. As we had already selected the data, therefore, it is
prefilled.
Step 3: Click on Next

Now the dialog box asks us whether we want our pivot table in the same worksheet or a new
worksheet. So,
Step 4: Select the New worksheet and click on Finish.

G. Amulya, Assistant Professor, CSE 10


Now a Pivot Table is created with the PivotTable Fields pane on the right side of the
Worksheet.

Step 5: Drag the field Quarter in the area Columns, Year in Filters, Product in Rows and Sales
in Values.

G. Amulya, Assistant Professor, CSE 11


The Pivot Table is created as shown below

The above table shows the Total Sales of 9161.


Example #3
The below table shows a list of brands with their model, color, mileage, and price. We want
to find the total price of all the Models of a Brand using the Pivot Table.

G. Amulya, Assistant Professor, CSE 12


Solution:
Step 1: Select the data table and click on Insert > Pivot Table
The Pivot table from table or range dialogue box appears
Step 2: Choose Existing Worksheet, specify the location by clicking on the desired cell, and
click OK.

Note: The Table/Range is pre-filled as we had selected the data table.


The Pivot Table is created as shown below with the Fields pane on the right side.

G. Amulya, Assistant Professor, CSE 13


Step 3: Drag the field Brand in the area Filters, Model in Rows, Color in Columns and Price in
Values.

G. Amulya, Assistant Professor, CSE 14


The Pivot Table is created as shown below with a total price of $ 60203.

Step 4: Click the dropdown (filter) and select Toyota > Select Multiple Items > OK

Excel creates a Pivot Table showing the total price ($ 17770) for all the models of Toyota

G. Amulya, Assistant Professor, CSE 15


How to Move a Pivot Table in Excel?
To move a Pivot Table,
1. Select the Pivot Table > PivotTable Analyze > Move PivotTable

2. Specify the new location and click OK

Sorting of the data in the pivot table


You can sort the data in a PivotTable so that it will be easy for you to find the items you want
to analyze. You can sort the data from lowest to highest values or highest to lowest values or
in any other custom order that you choose.
Consider the following PivotTable wherein you have the summarized sales data region-wise,
salesperson-wise and month-wise.

G. Amulya, Assistant Professor, CSE 16


Sorting on Fields
You can sort the data in the above PivotTable on Fields that are in Rows or Columns – Region,
Salesperson and Month.
To sort the PivotTable with the field Salesperson, proceed as follows −
 Click the arrow in the Row Labels.
 Select Salesperson in the Select Field box from the dropdown list.

G. Amulya, Assistant Professor, CSE 17


The following sorting options are displayed −

 Sort A to Z.

 Sort Z to A.

 More Sort Options.


Further, the Salesperson field is sorted in ascending order, by default. Click Sort Z to A. The
Salesperson field will be sorted in descending order.

G. Amulya, Assistant Professor, CSE 18


In the same way, you can sort the field in column – Month, by clicking on the arrow in the
column labels.
Sorting on Subtotals
Suppose you want to sort the PivotTable based on total order amount – highest to lowest in
every Region. That is, you want to sort the PivotTable on subtotals.

You can see that there is no arrow for subtotals. You can still sort the PivotTable on
subtotals as follows −

G. Amulya, Assistant Professor, CSE 19


 Right-click on the subtotal of any of the Salespersons in the Grand Total
column.
 Select Sort from the dropdown list.
 Another dropdown list appears with the sorting options – Sort Smallest to
Largest, Sort Largest to Smallest and More Sort Options. Select Sort Largest to
Smallest.

The subtotals in the Grand Total column are sorted from highest to lowest values, in every
region.

Likewise, if you want to sort the PivotTable on subtotals region wise, do the following −
 Right click on the subtotal of any of the regions in the Grand Total column.

G. Amulya, Assistant Professor, CSE 20


 Click Sort in the dropdown list.
 Click Sort Largest to Smallest in the second dropdown list. The PivotTable will
get sorted on subtotals region-wise.

As you can observe, South has the highest order amount while North has the lowest.
You can also sort the PivotTable based on the total amount month wise as follows −

 Right click on any of the Subtotals in the Grand Total row.

 Select Sort from the dropdown list.

 Select Sort Largest to Smallest from the second dropdown list.


The PivotTable will be sorted on total amount month wise.

G. Amulya, Assistant Professor, CSE 21


You can observe that February has highest order amount while March has the lowest.
More Sort Options
Suppose you want to sort the PivotTable on total amount region wise in the month of January.
 Click on the arrow in Row Labels.
 Select More Sort Options from the dropdown list. The Sort (Region) dialog box
appears.

As you can observe, under Summary, the current Sort order is given as Sort Region in
ascending order. Ascending (A to Z) by is selected under Sort Options. In the box below
that, Region is displayed.

G. Amulya, Assistant Professor, CSE 22


 Click the box containing Region.

 Click Sum of Order Amount.

Click the More Options button. The More Sort Options (Region) dialog box appears.

As you can observe, under Sort By, Grand Total is selected. Under Summary, the current sort
order is given as Sort Region by Sum of Order Amount in ascending order.
 Click Values in selected column: under Sort By.
 In the box below that, type B5.

G. Amulya, Assistant Professor, CSE 23


As you can observe, under Summary, the current sort order is given as follows −
 Sort Region by Sum of Order Amount in ascending order using values in this
column: January. Click OK.
 The Sort (Region) dialog box appears. Select Descending (Z to A) by: under Sort
Options.

Under Summary, the current sort order is given as follows −


Sort Region by Sum of Order Amount in descending order, using values in this column:
January. Click OK. The PivotTable will be sorted on region, using values in January.

G. Amulya, Assistant Professor, CSE 24


As you can observe, in the month of January, West has the highest order amount while North
has the lowest.
Sorting Data Manually
In the PivotTable, the data is sorted automatically by the sorting option that you have chosen.
This is termed as AutoSort.
Place the cursor on the arrow in Row Labels or Column Labels.

G. Amulya, Assistant Professor, CSE 25


AutoSort appears, showing the current sort order for each of the fields in the PivotTable. Now,
suppose you want to sort the field Region in the order – East, West, North and South. You can
do this manually, as follows −
 Click the arrow in Row Labels.
 Select Region in the Select Field box from the dropdown list.
 Click More Sort Options. The Sort (Region) dialog box appears.
 Select Manual (you can drag items to rearrange them).
 Click OK.

Under Summary, the current sort order is given as Drag items of the Region field to display
them in any order.
Click on the East and drag it to the top. While you are dragging East, a horizontal green bar
appears across the entire row moves.

G. Amulya, Assistant Professor, CSE 26


Repeat the dragging with other items of the Region field until you get the required
arrangement.

You can observe the following −


 The items of the nested field – Salesperson also move along with the
corresponding Region field item. Further, the values in the other columns also
moved accordingly.

G. Amulya, Assistant Professor, CSE 27


 If you place the cursor on the arrow in Row Labels or Column Labels,
AutoSort appears showing the current sort order of the fields Salesperson and
Month only. As you have sorted Region field manually, it will not show up in
AutoSort.
Note − You cannot use this manual dragging of items of the field that is in ∑ VALUES area of
the PivotTable Fields list. Therefore, you cannot drag the Sum of Order Amount values in this
PivotTable.
Setting Sort Options
In the previous section, you have learnt how to set the sorting option for a field to manual.
You have some more sort options that you can set as follows −
 Click the arrow in Row Labels.
 Select Region in the Select Field box.
 Click More Sort Options. The Sort (Region) dialog box appears.
 Click the More Options button.
More Sort Options (Region) dialog box appears. You can set more sort options in this dialog
box.

Under AutoSort, you can check or uncheck the box - Sort automatically every time the report
is updated, to allow or stop automatic sorting whenever the PivotTable data is updated.

 Uncheck the box – Sort automatically every time the report is updated.
Now, First key sort order option becomes available. You can use this option to select the
custom order you want to use.

 Click the box under First key sort order.

G. Amulya, Assistant Professor, CSE 28


As you can observe, day-of-the-week and month-of-the year custom lists are provided in the
dropdown list. You can use any of these, or you can use your own custom list such as High,
Medium, Low or the sizes list S, M, L, XL that are not in alphabetical order.
You can create your custom lists from the FILE tab on the Ribbon. FILE → Options. In the Excel
Options dialog box, click on advanced and browse to General. You will find the Edit Custom
Lists button next to Create lists for use in sort and fill sequences.

G. Amulya, Assistant Professor, CSE 29


Note that a custom list sort order is not retained when you update (refresh) data in your
PivotTable.
Under Sort By, you can click Grand Total or Values in selected columns to sort by these values.
This option is not available when you set sorting to Manual.

Filtering data in Pivot table

You might have to do in-depth analysis on a subset of your PivotTable data. This might be
because you have large data and your focus is required on a smaller portion of the data or
irrespective of the size of the data, your focus is required on certain specific data. You can
filter the data in the PivotTable based on a subset of the values of one or more fields. There
are several ways to do that as follows −

 Filtering using Slicers.

 Filtering using Report Filters.

 Filtering data manually.

 Filtering using Label Filters.

 Filtering using Value Filters.

 Filtering using Date Filters.

 Filtering using Top 10 Filter.

 Filtering using Timeline.


You will learn filtering data using Slicers in the next chapter. You will understand filtering by
the other methods mentioned above in this chapter.
Consider the following PivotTable wherein you have the summarized sales data region wise,
salesperson wise and month wise.

G. Amulya, Assistant Professor, CSE 30


Report Filters
You can assign a Filter to one of the fields so that you can dynamically change the PivotTable
based on the values of that field.
Drag Region from Rows to Filters in the PivotTable Areas.

The Filter with the label as Region appears above the PivotTable (in case you do not have
empty rows above your PivotTable, PivotTable gets pushed down to make space for the Filter.

G. Amulya, Assistant Professor, CSE 31


You will observe that
 Salesperson values appear in rows.
 Month values appear in columns.
 Region Filter appears on the top with default selected as ALL.
 Summarizing value is Sum of Order Amount.
o Sum of Order Amount Salesperson-wise appears in the column Grand Total.
o Sum of Order Amount Month-wise appears in the row Grand Total.
 Click on the arrow in the box to the right of the Filter Region.
A drop-down list with the values of the field Region appears. Check the box Select Multiple
Items.

By default, all the boxes are checked. Uncheck the box (All). All the boxes will be unchecked.
Then check the boxes - South and West and click OK.

G. Amulya, Assistant Professor, CSE 32


The data pertaining to South and West regions only will get summarized.

In the cell next to the Filter Region - (Multiple Items) is displayed, indicating that you have
selected more than one item. However, how many items and / or which items is not known
from the report that is displayed. In such a case, using Slicers is a better option for filtering.
Manual Filtering
You can also filter the PivotTable by picking the values of a field manually. You can do this by
clicking on the arrow in the Row Labels or Column Labels cell.

G. Amulya, Assistant Professor, CSE 33


Suppose you want to analyze only February data. You need to filter the values by the field
Month. As you can observe, Month is part of Column Labels.
Click on the arrow in the Column Labels cell.
As you can observe, there is a Search box in the dropdown list and below the box, you have
the list of the values of the selected field, i.e. Month. The boxes of all the values are checked,
showing that all the values of that field are selected.

 Uncheck the (Select All) box at the top of the list of values.
 Check the boxes of the values you want to show in your PivotTable, in this case
February and click OK.

G. Amulya, Assistant Professor, CSE 34


The PivotTable displays only those values that are related to the selected Month field value –
February. You can observe that the filtering arrow changes to the icon to indicate that a
filter is applied. Place the cursor on the icon.

You can observe that is displayed indicating that the Manual Filter is applied on the field-
Month.
If you want to change the filter selection value, do the following −
 Click the icon.
 Check / uncheck the boxes of the values.

G. Amulya, Assistant Professor, CSE 35


If all the values of the field are not visible in the list, drag the handle in the bottom-right corner
of the dropdown to enlarge it. Alternatively, if you know the value, type it in the Search box.
Suppose you want to apply another filter on the above filtered PivotTable. For example, you
want to display the data of that of Walters, Chris for the month February. You need to refine
your filtering by adding another filter for the field Salesperson. As you can observe,
Salesperson is part of Row Labels.
 Click on the arrow in the Row Labels cell.

The list of the values of the field – Region is displayed. This is because, Region is at outer level
of Salesperson in the nesting order. You also have an additional option – Select Field. Click on
the Select Field box.
 Click Salesperson from the dropdown list. The list of the values of the field –
Salesperson will be displayed.
 Uncheck (Select All) and check Walters, Chris.
 Click OK.

G. Amulya, Assistant Professor, CSE 36


The PivotTable displays only those values that are related to the selected Month field value –
February and Salesperson field value - Walters, Chris.
The filtering arrow for Row Labels also changes to the icon to indicate that a filter is
applied. Place the cursor on the icon on either Row Labels or Column Labels.

A text box is displayed indicating that the Manual Filter is applied on the fields – Month, and
Salesperson.
You can thus filter the PivotTable manually based on any number of fields and on any number
of values.
Filtering By Text
If you have fields that contain text, you can filter the PivotTable by Text, provided the
corresponding field label is text-based. For example, consider the following Employee data.

G. Amulya, Assistant Professor, CSE 37


The data has the details of the employees – EmployeeID, Title, BirthDate, MaritalStatus,
Gender and HireDate. Additionally, the data also has the manager level of the employee
(levels 0 – 4).
Suppose you have to do some analysis on the number of employees reporting to a given
employee by title. You can create a PivotTable as given below.

You might want to know how many employees with ‘Manager’ in their title have employees
reporting to them. As the Label Title is text-based, you can apply the Label Filter on the Title
field as follows −

G. Amulya, Assistant Professor, CSE 38


 Click on the arrow in the Row Labels cell.
 Select Title in the Select Field box from the drop down list.
 Click on Label Filters.
 Click on Contains in the second dropdown list.

Label Filter (Title) dialog box appears. Type Manager in the box next to Contains. Click OK.

The PivotTable will be filtered to the Title values containing ‘Manager’.

G. Amulya, Assistant Professor, CSE 39


 Click the icon.

You can see that is displayed indicating the following −

 The Label Filter is applied on the field – Title, and

 What the applied Label Filter is.

Filtering by Values
You might want to know the titles of the employees who have more than 25 employees
reporting to them. For this, you can apply the Value Filter on the Title field as follows −
 Click on the arrow in the Row Labels cell.
 Select Title in the Select Field box from the drop down list.
 Click on Value Filters.
 Select Greater than or equal to from the second dropdown list.

G. Amulya, Assistant Professor, CSE 40


The Value Filter (Title) dialog box appears. Type 25 in the right side box.
The PivotTable will be filtered to display the employee titles who have more than 25
employees reporting to them.

Filtering by Dates
You might want to display the data of all the employees who were hired in the fiscal year
2015-15. You can use Data Filters for the same as follows −
 Include the HireDate field in the PivotTable. Now, you do not require manager
data and so remove ManagerLevel field from the PivotTable.

G. Amulya, Assistant Professor, CSE 41


Now that you have a Date field in the PivotTable, you can use Date Filters.
 Click the arrow in the Row Labels cell.
 Select HireDate in the Select Field box from the drop down list.
 Click Date Filters.
 Seelct Between from the second dropdown list.

G. Amulya, Assistant Professor, CSE 42


The Date Filter (HireDate) dialog box appears. Type 4/1/2014 and 3/31/2015 in the two Date
boxes. Click OK.

The PivotTable will be filtered to display only the data with HireDate between 1 st Nov 2018
and 31st March 2019.

G. Amulya, Assistant Professor, CSE 43


You can group the dates into Quarters as follows −
 Right click on any of the dates. The Grouping dialog box appears.
 Type 06/072018 in the box Starting at. Check the box.
 Type 11/06/2019 in the box Ending at. Check the box.
 Click Quarters in the box under By.

G. Amulya, Assistant Professor, CSE 44


The dates will be grouped into quarters in the PivotTable. You can make the table look
compact by dragging the field HireDate from ROWS area to COLUMNS area.
You will be able to know how many employees were hired during the fiscal year, quarter wise.

G. Amulya, Assistant Professor, CSE 45


Filtering Using Top 10 Filter
You can use the Top 10 Filter to display the top few or bottom few values of a field in the
PivotTable.
 Click the arrow in the Row Labels cell.
 Click Value Filters.
 Click Top 10 in the second dropdown list.

Top 10 Filter (Title) dialog box appears.


 In the first box, click on Top (You can choose Bottom also).
 In the second box, enter a number, say, 7.
 In the third box, you have three options by which you can filter.
o Click on Items to filter by number of items.
o Click on Percent to filter by percentage.
o Click on Sum to filter by sum.
 As you have count of EmployeeID, click Items.
 In the fourth box, click on the field Count of EmployeeID.
 Click OK.

G. Amulya, Assistant Professor, CSE 46


The top seven values by count of EmployeeID will be displayed in the PivotTable.

As you can observe, the highest number of hires in the fiscal year is that of Production
Technicians and a predominant number of these are in Qtr1.
Filtering Using Timeline
If your PivotTable has a date field, you can filter the PivotTable using Timeline.
Create a PivotTable from the Employee Data that you used earlier and add the data to the
Data Model in the Create PivotTable dialog box.
 Drag the field Title to ROWS area.
 Drag the field EmployeeID to ∑ VALUES area and choose Count for calculation.

G. Amulya, Assistant Professor, CSE 47


 Click on the PivotTable.
 Click the INSERT tab.
 Click Timeline in the Filters group. The Insert Timelines dialog box appears.

 Check the box HireDate.

 Click OK. The Timeline appears in the worksheet.

 Timeline Tools appear on the Ribbon.

G. Amulya, Assistant Professor, CSE 48


As you can observe, All Periods – in Months are displayed on the Timeline.
 Click on the arrow next to - MONTHS.
 Select QUARTERS from the drop-down list. The The Timeline display changes to
All Periods – in Quarters.

 Click on 2014 Q1.


 Keep the Shift key pressed and drag to 2014 Q4. The Timeline Period is selected
to Q1 – Q4 2014.
 PivotTable is filtered to this Timeline Period.

G. Amulya, Assistant Professor, CSE 49


Clearing the Filters
You might have to clear the filters you have set from time to time to switch across different
combinations and projections of your data. You can do this in several ways as follows −
1. Clearing all the filters in a PivotTable
You can clear all the filters set in a PivotTable at one go as follows −

 Click the HOME tab on the Ribbon.

 Click Sort & Filter in the Editing group.

 Select Clear from the dropdown list.

G. Amulya, Assistant Professor, CSE 50


2. Clearing a Label, Date or Value Filter
To clear a Label, Date, or Value Filter do the following −
 Click on the icon in the Row Labels or Column Labels.
 Click on the <field name> from which you want to clear the filter in the
Select Field box in the dropdown list.
 Click on Clear Filter From <Filed Name> that appears in the dropdown list.
 Click OK. The specific filter will be cleared.

Perform calculations in Pivot Table

In Excel, we can add and modify the formula available in default calculated fields once we
create a pivot table. To see and update the pivot table formula, create a pivot table with
relevant fields we want to keep. After selecting or putting the cursor on it, select Calculated
Fields from the drop-down list of Fields, Items & Sets from Analyze menu ribbon. There we
will be able to see all the fields used in the pivot table along with the section Name and
Formula section.
Custom Field to Calculate Profit Amount
This is the most often used calculated field in the pivot table. Please take a look at the below
data; I have Country Name, Product Name, Units Sold, Unit Price, Gross Sales, COGS (Cost of
Goods Sold), Date, and Year column.

G. Amulya, Assistant Professor, CSE 51


Let me apply the pivot table to find the total sales and total cost for each country. Below is
the pivot table for the above data.

G. Amulya, Assistant Professor, CSE 52


The problem is I don’t have a profit column in the source data. I need to find out the profit
and profit percentage for each country. We can add these two columns to the pivot table
itself.
Step 1: Select a cell in the pivot table. Go to Analyze tab in the ribbon and select Fields, Items,
& Sets. Under this, select Calculated Field.

Step 2: In the below dialog box, give a name to your new calculated field.

Step 3: In the Formula section, apply the formula to find the Profit. The formula to find the
Profit is Gross Sales – COGS.
Go inside the formula bar > Select Gross Sales from the below Field and double click it
will appear in the Formula bar.

G. Amulya, Assistant Professor, CSE 53


Now type minus symbol ( – ) and select COGS > Double click.

Step 4: Click on ADD and OK to complete the formula.

Step 5: Now, we have our TOTAL PROFIT Column in the pivot table.

G. Amulya, Assistant Professor, CSE 54


This calculated field is flexible, it is not only limited to Country-wise analysis, but we can use
this for all kinds of analysis. If I want to see the analysis country-wise and product-wise, I just
have to drag and drop the product column to the ROW field; it will show the breakup of profit
for each product under each country.

G. Amulya, Assistant Professor, CSE 55


Step 6: Now, we need to calculate the profit percentage. The formula to calculate the Profit
Percentage is Total Profit / Gross Sales.
Go to Analyze and again select Calculated Field under Fields, Items, & Sets.
Step 7: Now, we must see the newly inserted calculated field Total Profit in the Fields list.
Insert this field to the formula.

Step 8: Type divider symbol (/) and insert Gross Sales Field.

G. Amulya, Assistant Professor, CSE 56


Step 9: Name this Calculated Field as Profit Percentage.

Step 10: Click on ADD and OK to complete the formula. We have Profit Percentage as the new
column.

Advanced Formula in Calculated Field


Whatever I have shown now is the basic stuff of Calculated Field. In this example, I will show
you the advanced formulas in pivot table calculated fields. Now I want to calculate the
incentive amount based on the profit percentage.
If the Profit % is >15% incentive should be 6% of the total profit.
If the Profit % is >10% incentive should be 5% of the total profit.
If the Profit % is <10% incentive should be 3% of the total profit.
Step 1: Go to Calculated Field and open the below dialog box. Give the name as Incentive
Amount.

G. Amulya, Assistant Professor, CSE 57


Step 2: Now, I will use the IF condition to calculate the incentive amount. Apply the below
formulas as shown in the image.
=IF (‘ProfitPercentage’>15%, ‘TotalProft’*6%, IF(‘ProfitPercentage’>10%, ‘Total Proft’*5%,
‘Total Proft’ *3%))

Step 3: Click on ADD & OK to complete. Now we have an Incentive Amount column.

Limitation of Calculated Field


We have seen the wonder of Calculated Fields, but it has some of the limitations as well. Now
take a look at the below image; if I want to see the breakup of the Product-wise Incentive
amount, we will have the wrong SUB TOTAL & GRAND TOTAL of INCENTIVE AMOUNT.

G. Amulya, Assistant Professor, CSE 58


So be careful while showing the Subtotal of calculated fields. It will show you the wrong
amounts.
Get a List of All the Calculated Field Formulas
If you do not know how many formulas are there in the pivot table calculated field, you can
get the summary of all these in a separate worksheet.
Go to Analyze > Fields, Items, & Sets –> List Formulas.

It will give you a summary of all the formulas in a new worksheet.

G. Amulya, Assistant Professor, CSE 59


Things to Remember About Pivot Table Formula in Excel
 We can delete, modify all the calculated fields.
 We cannot use formulas like VLOOKUP, SUMIF, and many other ranges involved
formulas in calculated fields, i.e. all the formulas which require range cannot be used.

Pivot Chart and other visualizations

Most often, when the data is big and huge, it is difficult to draw conclusions and tell the stories
behind the data. Pivot table could well be the tool that can help us in these crunch situations.
A pivot table can cut, slice, summarize and give meaningful results from the data. Usually, in
excel, after summarizing the data, we apply graphs or charts to present the data graphically
to tell the story visually.
The pivot table does not require your special charting techniques rather; it can build its own
chart using its own data. Pivot charts work directly with the pivot table and visualize the data
in the most effective way.
In this you we will learn the process of creating pivot charts in excel. This will be beneficial for
you in your day to day workplace.
How to Create Pivot Chart in Excel?
A pivot table is available in all versions of Excel.
I have sales data of 4 regions across many months. I want to know the summary behind this
data by using a pivot table in excel.

G. Amulya, Assistant Professor, CSE 60


Step 1: Select the data.
Step 2: Go to Insert and apply a pivot table.

Step 3: Click OK.

G. Amulya, Assistant Professor, CSE 61


Step 4: Drag and drop Region heading to the ROWS and Sum of Amt heading to the VALUES.

Now we have a summary report region-wise put together of all the months.

G. Amulya, Assistant Professor, CSE 62


This report is only showing a numerical summary; if you need a graphical summary, you can
insert Pivot Chart.
Step 5: Place the cursor inside the pivot table and go to Options. Under this, you will see the
Pivot Chart option.

Step 6: Once you click on Pivot Chart, it will show you all the available charts for you. Select
any one of them as per your wish.

Step 7: Your initial chart looks like this.

G. Amulya, Assistant Professor, CSE 63


Step 8: Now add the Month heading to the COLUMNS field. It will break up the report into
region-wise & month-wise.

Step 9: Now, look back at the chart. It has automatically updated its charting field. It is also
showing the breakup of region-wise & month-wise visuals.

G. Amulya, Assistant Professor, CSE 64


Step 10: Now, if you observe, there is one drop-down list available for MONTH & REGION in
the chart itself. This is the controls for the chart.

Step 11: If you want to show the result only for the month of Jan, you can select the Jan month
from the drop-down list.

Step 12: It will start to show the results only for the month of Jan. The important thing is not
only in the chart section but also in the pivot region as well.

G. Amulya, Assistant Professor, CSE 65


Step 13: Not only a pivot chart controls the pivot, but a pivot table to controls the pivot chart.
Now the filter is applied in the pivot chart, but I can also release the filter in the pivot table as
well.

Note: Both PIVOT TABLE and PIVOT CHARTS are interdependent. If any changes made to any
file, it will affect both of them simultaneously. Both are an interdependent option in excel.
Insert a Slicer to the Table
All these while you worked with filters in excel. But we have visual filters in excel. Slicers are
visual filters to filter out any particular category for us.
In our previous section, we selected the month from the drop-down list either on pivot chart
or on pivot field, but using SLICERS, we can visually.
Step 1: Place a cursor inside the pivot table.

G. Amulya, Assistant Professor, CSE 66


Step 2: Go to Option and select Insert Slicer.

Step 3: It will show you the options dialogue box. Select for which field you need a slicer.

Step 4: After selecting the option, you will see the actual slicer visual in your worksheet.

G. Amulya, Assistant Professor, CSE 67


Step 5: Now, you can control both table and chart from the SLICERS itself. As per the selection
you make in the slicer, both table and chart will show their results accordingly.

Advantages
 Effective and dynamic chart.
 Visualization and numbers are interdependent.
 It shows drops, highs, lows, everything in a single graph.
 Large data into a concise size.
Things to Remember about Excel Pivot Chart
 If the data is increasing, you need to change the range of the pivot table every time
data increases. So, I will advise you to use Excel Tables for auto-updating of the pivot
ranges.
 Both PIVOT FIELD & PIVOT CHARTS are interdependent.
 SLICERS can control both of them at a time
 Since the chart is directly connected to the changing numbers, the range it becomes
dynamic in nature.

G. Amulya, Assistant Professor, CSE 68

You might also like