DV Unit - VI Notes
DV Unit - VI Notes
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 −
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,
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.
Solution:
Step 1: Select the data table and click on the Insert menu
Step 2: Click on Pivot Table
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.
Step 4: Click on the Correct checkbox > Select Multiple Items > OK
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
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
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.
Step 5: Drag the field Quarter in the area Columns, Year in Filters, Product in Rows and Sales
in Values.
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
Sort A to Z.
Sort Z to A.
You can see that there is no arrow for subtotals. You can still sort the PivotTable on
subtotals as follows −
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.
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 −
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.
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.
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.
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.
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 −
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.
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.
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.
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.
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.
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.
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.
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 −
Label Filter (Title) dialog box appears. Type Manager in the box next to Contains. Click OK.
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.
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.
The PivotTable will be filtered to display only the data with HireDate between 1 st Nov 2018
and 31st March 2019.
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.
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.
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.
Step 5: Now, we have our TOTAL PROFIT Column in the pivot table.
Step 8: Type divider symbol (/) and insert Gross Sales Field.
Step 10: Click on ADD and OK to complete the formula. We have Profit Percentage as the new
column.
Step 3: Click on ADD & OK to complete. Now we have an Incentive Amount column.
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.
Now we have a summary report region-wise put together of all the months.
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 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.
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.
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.
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.
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.