0% found this document useful (0 votes)
21 views30 pages

5 - Pivot Tables

The document provides a comprehensive overview of Pivot Tables in Excel, detailing their functionality for data analysis and visualization. It includes step-by-step instructions for creating and customizing Pivot Tables, as well as tips for data formatting and utilizing features like slicers and timelines. Additionally, it discusses the use of dashboards for visual representation of key business measures derived from Pivot Tables.

Uploaded by

omar Yousef
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)
21 views30 pages

5 - Pivot Tables

The document provides a comprehensive overview of Pivot Tables in Excel, detailing their functionality for data analysis and visualization. It includes step-by-step instructions for creating and customizing Pivot Tables, as well as tips for data formatting and utilizing features like slicers and timelines. Additionally, it discusses the use of dashboards for visual representation of key business measures derived from Pivot Tables.

Uploaded by

omar Yousef
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/ 30

Data Analytics

DS342

11 November 2024 Dr. Marwa Sabry 1-2


Chapter 4
Data Visualization
Pivot Tables

3
Pivot Tables

• A Pivot Table is a powerful tool in Excel used to calculate,


summarize, and analyze data. It allows you to see comparisons,
patterns, and trends in your data. Pivot Tables function slightly
differently depending on the platform you are using to run Excel.
4.3 Pivot Tables

• The pivot table is an Excel tool that allows you to break data down by
categories.
• Sometimes pivot tables are used to display tables of counts, often
called crosstabs or contingency tables.
• However, crosstabs typically list only counts, whereas pivot tables can
list counts, sums, averages, and other summary measures.
• PivotTables allows you to create custom summaries and charts of key
information in the data.
Create a PivotTable in Excel for Windows

1. Select the cells you want to create a Pivot Table from.


2. Select Insert > PivotTable.
3. This creates a PivotTable based on an existing table or
range.
4. Choose where you want the PivotTable report to be
placed. Select New Worksheet to place the
PivotTable in a new worksheet or Existing
Worksheet and select where you want the new
PivotTable to appear.
5. Select OK.
Data format tips and tricks

• Use clean, tabular data for best results.


• Organize your data in columns, not rows.
• Ensure all columns have headers with a single row
of unique, non-blank labels for each column. Avoid
double rows of headers or merged cells.
• Format your data as an Excel table: Select
anywhere in your data, and then select Insert >
Table from the ribbon.
• If you have complicated or nested data, use Power
Query to transform it (for example, to unpivot your
data) so it's organized in columns with a single
header row.
Constructing PivotTables

Click inside your database


Insert >
Tables >
PivotTable
The wizard creates a blank
PivotTable as shown.
PivotTable Field List

Select and drag the fields to one


of the PivotTable areas:
 Report Filter
 Column Labels
 Row Labels
 Σ Values
Elecmart Sales.xlsx
• Objective: To use pivot tables to break down the customer order data by a
number of categorical variables.
• Solution: Data set contains data on 400 customer orders during several
months for Elecmart company.
• Create a pivot table by clicking the PivotTable button on the Insert ribbon.
Working with PivotTables Values
• Summarize Values By
• By default, PivotTable fields placed in the Values area are displayed as a SUM. If
Excel interprets your data as text, it will be displayed as a COUNT. Therefore, it is
crucial to ensure that you don't mix data types for value fields.
• To change the default calculation:
• Select the arrow to the right of the field name in the Values area.
• Choose Value Field Settings from the dropdown menu.
• In the Summarize Values By section, select your preferred calculation
method (e.g., Average, Max, Min, etc.).
• Note that when you change the calculation method, Excel automatically appends it in
the Custom Name section, such as "Sum of FieldName." You can modify this name
if needed.
• To change the number format for the entire field:
• Select Number Format within the Value Field Settings dialog box.
• Choose your desired number format and apply it.
Working with PivotTables Values
• Show Values As
• Display as Percentage: Instead of summarizing data with a calculation, you
can display it as a percentage of a field. For example, you might change
household expense amounts to display as a % of Grand Total instead of the
sum of the values.
• To configure this:
• Open the Value Field Settings dialog box.
• Select the Show Values As tab.
• Choose the percentage option you want (e.g., % of Grand Total, % of
Column Total, etc.).
• Display Both Calculation and Percentage:
• To show a value as both a calculation and a percentage, drag the item into the
Values section twice.
• Set the Summarize Values By option for the first instance and configure the
Show Values As option for the second instance to display it as a percentage.
Hiding Categories (Filtering)

• You can filter out any items in a pivot table


that you don’t want to see.
• Click the Row Labels dropdown arrow of the
active field and check the items you want to
filter on.
• A pivot table with hidden categories is
shown below.
Sorting on Values or Categories

• It is easy to sort in a pivot table, either by the numbers in the Values


area or by the labels in a Rows or Columns field.
• To sort by the numbers in the Values area, right-click any number and
select Sort.
• To sort on the labels of a Rows or Columns field, right-click any of the
categories and select Sort.
• You can also click the dropdown arrow for the field and get the dialog box that allows
both sorting and filtering.
Changing Locations of Fields (Pivoting)

• You can choose where to place variables in a pivot table.


• For example, to place the Region variable in the Columns area, drag the
Region button from the Rows area of the PivotTable Fields pane to the
Columns area.
Changing Field Settings

• You can change various settings in the Field Settings dialog box.
• To get to this dialog box:
• Click the Field Setting button on the Analyze/Options ribbon.
• OR right-click any of the pivot table cells and select the Field Settings item.
• The pivot table with Value Field Settings changed to Average is shown
below.
Pivot Charts

• It is easy to accompany pivot tables


with pivot charts.
• These charts adapt automatically to
the underlying pivot table.
• To create a pivot chart, click anywhere
inside the pivot table, select the
PivotChart button on the
Analyze/Options ribbon, and select a
chart type.
Multiple Variables in the Values Area

• More than a single variable can be placed in the Values area.


• Also, a given variable in the Values area can be summarized by more
than one summarizing function.
Summarizing by Count

• The variable in the Values area can be summarized by the Count function.
• This is useful when you want to know, for example, how many of the orders were placed by
females in the South.
• Right-click any number in the pivot table, select Value Field Settings, and select the Count
function.
Grouping

• Categories in a Rows or Columns variable can be grouped.


• Suppose you want to summarize Sum of Total Cost by Date.
• Starting with a blank pivot table, check both Date and Total Cost in the PivotTable Fields
pane.
• Then right-click any date and select Group.
Other Pivot Table Features

• Showing/hiding subtotals and grand totals (check the Layout options on the Design
ribbon)
• Dealing with blank rows, that is, categories with no data (right-click any number, choose
PivotTable Options, and check the options on the Layout & Format tab)
• Displaying the data behind a given number in a pivot table (double-click any number in
the Values area to get a new worksheet)
• Formatting a pivot table with various styles (check the style options on the Design ribbon)
• Moving or renaming pivot tables (check the PivotTable and Action groups on the
Analyze/Options ribbon)
• Refreshing pivot tables as the underlying data changes (check the Refresh dropdown list
on the Analyze/Options ribbon)
• Creating pivot table formulas for calculated fields or calculated items (check the Formulas
dropdown list on the Analyze/Options ribbon)
Slicers and Timelines

• In Excel 2010, Microsoft added slicers—lists of the distinct values of


any variable, which you can then filter on.
• You add a slicer from the Analyze/Options ribbon under PivotTable Tools.
• In Excel 2013 and above, a Timeline feature was added. A Timeline is
like a slicer, but it is specifically for filtering on a date variable.
Use slicers to filter data
1. Click anywhere in the table or PivotTable.
2. On the Insert tab, select Slicer.
3. Insert Slicer
4. In the Insert Slicers dialog box, select the check boxes for the fields you want to display, then select OK.
5. A slicer will be created for every field that you selected. Clicking any of the slicer buttons will
automatically apply that filter to the linked table or PivotTable.
Format a slicer
1. You can adjust your slicer preferences in the Slicer tab (in newer versions of Excel), or the Design tab
(Excel 2016 and older versions) on the ribbon.
2. On the Slicer or Design tab, select a color style that you want.

Make a slicer available in another PivotTable


1. First create a PivotTable that is based on the same data source as the PivotTable that already has the slicer want to
reuse.
2. Select the slicer that you want to share in another PivotTable. This displays the Slicer tab.
3. On the Slicer tab, select Report Connections.
4. In the dialog box, select the check box of the PivotTable in which you want the slicer to be available.
Timeline to filter dates
Instead of adjusting filters to show dates, you can use a PivotTable Timeline—a dynamic filter option
that lets you easily filter by date/time and zoom in on the period you want with a slider control. Click
Analyze > Insert Timeline to add one to your worksheet.
1. Click anywhere in a PivotTable to show the PivotTable Tools ribbon group, then click Analyze >
Insert Timeline.
2. In the Insert Timeline dialog box, check the date fields you want, and click OK.

Use a Timeline to filter by time period


With your Timeline in place, you’re ready to filter by a time period in one of four-time levels
(years, quarters, months, or days).

1. Click the arrow next to the time level shown and pick the one you want.
2. Drag the Timeline scroll bar to the time period you want to analyze.
3. In the timespan control, click a period tile and drag to include additional tiles to select the date
range you want. Use the timespan handles to adjust the date range on either side.
Pivot Table with Slicers and a Timeline
Dashboards

• A dashboard is a visual representation of a set of key business measures. It is


derived from the analogy of an automobile’s control panel, which displays speed,
gasoline level, temperature, and so on.
• Dashboards provide important summaries of key business information to
help manage a business process or function.
• The camera tool is useful for creating PivotTable-based dashboards.
• If you create several different PivotTables and charts, you can easily use the camera
tool to take pictures of them and consolidate them onto one worksheet.
• In this fashion, you can still make changes to the PivotTables and they will
automatically be reflected in the camera shots.
Dashboards
11 November 2024
Dr. Marwa Sabry 29
11 November 2024
Dr. Marwa Sabry 30
Thank You ☺

31

You might also like