This is a presentation which is used in Healthcare IT Professional (HITP) course.
The goal is to show the student how data can be organized and manipulated (drill down, slice and dice..) using Excel.
This part comes after introduction to data warehouse and OLAP.
www.alamedaservices.com
2. 2
Pivot Table Introduction
A Pivot Table is the name Excel gives to what is more
commonly known as a cross‐tabulation table. Such
tables can be one, two or three‐dimensional and
offer a range of summary statistics. They can be
modified interactively and can be based on data
from more than one worksheet.
AlamedaServices.com
3. 3
Why organize list data into a Pivot Table?
Three key • To summarize the data contained in a lengthy list
into a compact format
reasons for • To find relationships within the data that are
organizing data otherwise hard to see because of the amount of
detail
into a Pivot • To organize the data into a format that’s easy to
Table are: chart
AlamedaServices.com
4. 4
PRODUCT REGION SALES_REVENUE
Hard Drive East $ 20,000.00
Hard Drive West $ 10,000.00
Hard Drive South $ 12,000.00
Hard Drive North $ 40,000.00
Printer East $ 109,000.00
Printer West $ 12,100.00
Printer South $ 120,800.00
Printer North $ 120,800.00
Zip Drive East $ 14,000.00
Zip Drive West $ 22,600.00
Zip Drive South $ 27,800.00
Zip Drive North $ 13,900.00
56K Modem East $ 13,500.00
56K Modem West $ 24,800.00
56K Modem South $ 21,000.00
56K Modem North $ 32,400.00
The spreadsheet illustration above is a simple Excel list. Even looking at this simple, short list
it’s difficult to discern patterns in the data.
For example, it takes a bit of study to see that the number of Units Sold in the North region is
much greater than the number of Units Sold for any other regions. Or to find out that PRINTER
is the most popular item in all regions.
AlamedaServices.com
5. 5
Sum of SALES_REVENUE PRODUCT
REGION 56K Modem Hard Drive Printer Zip Drive Grand Total
East 13500 20000 109000 14000 156500
North 32400 40000 120800 13900 207100
South 21000 12000 120800 27800 181600
West 24800 10000 12100 22600 69500
Grand Total 91700 82000 362700 78300 614700
By contrast, the Pivot Table above simplifies and summarizes the data to make
relationships and patterns obvious. And, if you had much more data in the list at
left (perhaps with many additional entries for each region), you could still achieve
a condensed Pivot Table summary the same size as the one at right. The Pivot
Table also allows you to include or exclude whatever list data you like.
Sum of SALES_REVENUE PRODUCT
Two REGION 56K Modem Hard Drive Printer Zip Drive Grand Total
Regions North 32400 40000 120800 13900 207100
South 21000 12000 120800 27800 181600
Grand Total 53400 52000 241600 41700 388700
Sum of SALES_REVENUE PRODUCT
REGION 56K Modem Hard Drive Grand Total
East
North
13500
32400
20000
40000
33500
72400
Two
South 21000 12000 33000 Products
West 24800 10000 34800
Grand Total 91700 82000 173700
AlamedaServices.com
7. 7
What’s Required to Construct a Pivot Table?
To create a
• a data field, where the data field is
Pivot Table the variable you want to summarize
you need to • a row and/or column field where the
identify these row and/or column fields are the
variables that will “control” the data
two elements summary
in your data:
AlamedaServices.com
9. 9
• Identifies the list range.
Step 2: • If you have the insertion point anywhere in the list
when you start the Wizard, Excel defines the list
range automatically.
AlamedaServices.com
10. 10
Step 3: • Creates the Pivot Table using its best guess as
to layout.
Use This
AlamedaServices.com
14. 14
Pivot Table Row and Column Fields
A row • A row field in a Pivot Table is a variable that takes on different
values. For example, a row field might be “Manufacturer” and its
values might be “Desire”, “Marco Polo Jeans”, “New Fashion”,
“Vector” and “Young Look”.
field • The values a variable takes on are sometimes referred to as
“items”.
In the example below, for each value of the
Sum of Monthly Sales
variable “Manufacturer”, the Pivot Table displays a
Manufacturer Total
summary of the chosen data field in an adjoining
column. The data field in this example is “Annual Desire 120000
Sales” and the summary function is sum. Marco Polo Jeans 78000
New Fashion 15000
Vector 30000
Notice that the Pivot Table uses the label “Sum of Young Look 48000
Annual Sales” to identify not only the data field Grand Total 291000
(Annual Sales) but also the default summary
operation (sum).
AlamedaServices.com
15. 15
A column • A Pivot Table column field works like a row field. A column field
might be the variable “Year” with values ranging from 1999 to
2001. Data beneath each column in the Pivot Table is
field associated with the year at the head of the column.
Manufacturer Year Annual Sales Sum of Annual Sales Year
Vector 1999 $220,000 Manufacturer 1999 2000 2001 Grand Total
New Fashion 1999 $108,000 Desire $456,000 $460,000 $410,000 $1,326,000
Young Look 1999 $300,000 Marco Polo Jeans $234,000 $280,000 $360,000 $874,000
Desire 1999 $456,000 New Fashion $108,000 $100,000 $120,000 $328,000
Marco Polo Jeans 1999 $234,000 Vector $220,000 $230,000 $200,000 $650,000
Vector 2000 $230,000 Young Look $300,000 $302,000 $320,000 $922,000
New Fashion 2000 $100,000 Grand Total $1,318,000 $1,372,000 $1,410,000 $4,100,000
Young Look 2000 $302,000
Desire 2000 $460,000
Marco Polo Jeans 2000 $280,000
Vector 2001 $200,000
New Fashion 2001 $120,000
Young Look 2001 $320,000
Desire 2001 $410,000
Marco Polo Jeans 2001 $360,000
AlamedaServices.com
17. 17
Sum of Annual Sales
Manufacturer Total
Desire $1,326,000
Marco Polo Jeans $874,000
Row‐only Pivot Table
New Fashion $328,000
Vector $650,000
Young Look $922,000
Grand Total $4,100,000
Sum of Annual Sales Year
1999 2000 2001 Grand Total
Total $1,318,000 $1,372,000 $1,410,000 $4,100,000
Column‐only
Pivot Table
AlamedaServices.com
19. 19
Another Example
Using <wine.xls> file
State Jan-2000 Feb-2000 Mar-2000 Apr-2000 May-2000 Jun-2000 Jul-2000 Sep-2000 Oct-2000 Nov-2000 Dec-2000
CA 849.9 1065 1013.05 1612.6 1776.8 1426.8 1606.55 3155.7 1871.7 2014.7 1935.5
MA 958 1309
NJ 1256.8 1151.4 1016.4 982.6 928 1559.4 1050.6 2341.9 902.8 1163.2 923.4
NY 1552.8 705 603.5 703.2 1324.9 977.4 998.9 1825.4 1172.8 970.5 1244.4
Grand Total 3659.5 2921.4 2632.95 4256.4 4029.7 3963.6 3656.05 7323 3947.3 5457.4 4103.3
Now lets try to make this a bit more complicated.
What if you wanted to see what type of product was sold in each State?
AlamedaServices.com
20. 20
Select any cell within
the existing Pivot Table,
then select the menu
item Data ‐ Pivot
Tables… you will go
back to the Wizard at
step 3.
Sum of Sales Month
State Type Jan-2000 Feb-2000 Mar-2000 Apr-2000 May-2000 Jun-2000 Jul-2000 Sep-2000 Oct-2000 Nov-2000
CA Red 592.5 648 648 799.2 913 649 910.5 2204.2 1102.2 1305.7
White 257.4 417 365.05 813.4 863.8 777.8 696.05 951.5 769.5 709
CA Total 849.9 1065 1013.05 1612.6 1776.8 1426.8 1606.55 3155.7 1871.7 2014.7
MA Red 591 906
White 367 403
MA Total 958 1309
NJ Red 606 342 342 528 466.5 750 685.2 2076.4 252 786.2
White 650.8 809.4 674.4 454.6 461.5 809.4 365.4 265.5 650.8 377
NJ Total 1256.8 1151.4 1016.4 982.6 928 1559.4 1050.6 2341.9 902.8 1163.2
NY Red 1166.4 447 443.5 568.2 1049.4 720 364.5 906 399 628.5
White 386.4 258 160 135 275.5 257.4 634.4 919.4 773.8 342
NY Total 1552.8 705 603.5 703.2 1324.9 977.4 998.9 1825.4 1172.8 970.5
Grand Total 3659.5 2921.4 2632.95 4256.4 4029.7 3963.6 3656.05 7323 3947.3 5457.4
AlamedaServices.com
21. 21
Pivot it!
Sum of Sales Month
Type State Jan-2000 Feb-2000 Mar-2000 Apr-2000 May-2000 Jun-2000 Jul-2000 Sep-2000 Oct-2000 Nov-2000
Red CA 592.5 648 648 799.2 913 649 910.5 2204.2 1102.2 1305.7
MA 591 906
NJ 606 342 342 528 466.5 750 685.2 2076.4 252 786.2
NY 1166.4 447 443.5 568.2 1049.4 720 364.5 906 399 628.5
Red Total 2364.9 1437 1433.5 2486.4 2428.9 2119 1960.2 5186.6 1753.2 3626.4
White CA 257.4 417 365.05 813.4 863.8 777.8 696.05 951.5 769.5 709
MA 367 403
NJ 650.8 809.4 674.4 454.6 461.5 809.4 365.4 265.5 650.8 377
NY 386.4 258 160 135 275.5 257.4 634.4 919.4 773.8 342
White Total 1294.6 1484.4 1199.45 1770 1600.8 1844.6 1695.85 2136.4 2194.1 1831
Grand Total 3659.5 2921.4 2632.95 4256.4 4029.7 3963.6 3656.05 7323 3947.3 5457.4
AlamedaServices.com
22. 22
Creating another Pivot Table based on an
existing Table
Now, let say we want to see both Sales and Margin side by side so that
we can compare them. We could create another pivot table. It is better
to base the new Pivot Table on the existing Pivot Table, because this
way Excel uses the same memory cache for both Pivot Tables thus
making sure you do not run out of memory on large Tables.
Select a blank cell on your worksheet and start the Pivot Table Wizard.
On the first screen, check the option button that says the data resides
in Another Pivot Table;
AlamedaServices.com
29. 29
Sum of Sales Month
State Type Qtr1 Qtr2 Qtr3 Qtr4 Grand Total
CA Red $1,889 $2,361 $3,115 $3,955 $11,319
White $1,039 $2,455 $1,648 $1,867 $7,009
CA Total $2,928 $4,816 $4,762 $5,822 $18,328
MA Red $591 $906 $1,497
White $367 $403 $770
MA Total $958 $1,309 $2,267
NJ Red $1,290 $1,745 $2,762 $1,655 $7,451
White $2,135 $1,726 $631 $1,335 $5,826
NJ Total $3,425 $3,470 $3,393 $2,989 $13,277
NY Red $2,057 $2,338 $1,271 $1,670 $7,335
White $804 $668 $1,554 $1,718 $4,744
NY Total $2,861 $3,006 $2,824 $3,388 $12,079
Grand Total $9,214 $12,250 $10,979 $13,508 $45,951
Note various formatting options used along with
this Pivot Table.
AlamedaServices.com
30. 30
Sum of Sales Month
State Group Qtr1 Qtr2 Qtr3 Qtr4 Grand Total
CA Blend $330 $685 $1,021 $1,865 $3,902
Creating Melot
Pinot Noir
$180
$708
$378
$626
$54
$1,240
$252
$1,167
$864
$3,741
another table Riesling
Semillon
$668
$372
$2,135
$320
$1,558
$90
$1,124
$743
$5,485
$1,524
based on CA Total
Shiraz $671
$2,928
$672
$4,816
$800
$4,762
$671
$5,822
$2,813
$18,328
previous MA Blend
Pinot Noir
$330 $786
$120
$1,116
$120
table using Riesling
Semillon
$207
$160
$403 $610
$160
GROUP” field. MA Total
Shiraz $261
$958 $1,309
$261
$2,267
NJ Blend $336 $1,720 $400 $2,456
Melot $468 $162 $342 $972
Pinot Noir $822 $708 $772 $386 $2,688
Riesling $1,571 $1,264 $631 $1,175 $4,641
Semillon $564 $461 $160 $1,185
Shiraz $539 $270 $527 $1,335
NJ Total $3,425 $3,470 $3,393 $2,989 $13,277
NY Blend $1,481 $1,651 $666 $501 $4,299
Melot $108 $108 $198 $414
Pinot Noir $313 $579 $234 $708 $1,834
Riesling $362 $668 $1,074 $1,436 $3,540
Semillon $442 $480 $282 $1,204
Shiraz $263 $263 $263 $788
NY Total $2,861 $3,006 $2,824 $3,388 $12,079
Grand Total $9,214 $12,250 $10,979 $13,508 $45,951
AlamedaServices.com
31. 31
Field calculations
Select a cell anywhere on the
Pivot Table and call the Pivot
Table Wizard. Sum of Sales is
shown in the Data area,
Double‐Click this. Notice that
you can show the sum of sales
or the count of the number of
sales during a period, or
several other calculations. For
now, leave the selection at
Sum. Click on the Options
button, then select % of row
from the Show data as:
dropdown list.
AlamedaServices.com