Hit 101 3 excel pivot tables - slides

1,290 views

Published on

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

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,290
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
61
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Hit 101 3 excel pivot tables - slides

  1. 1. 1Healthcare IT ProfessionalHIT 101-3 Using Excel for Data Management (PivotTables) AlamedaServices.com
  2. 2. 2Pivot 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. 3Why 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. 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.00The 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. 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 614700By 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 PRODUCTTwo REGION 56K Modem Hard Drive Printer Zip Drive Grand TotalRegions 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
  6. 6. 6You can easily chart the data organized into a Pivot Table, while to chart the data in the list first need to restructure the data and obtain the sum for each region. The Pivot Table simplifies the process because it obtains subtotals automatically and puts them in a range you can immediately use for charting. Drop Page Fields Here Sum of SALES_REVENUE 140000 120000 100000 PRODUCT 80000 56K Modem Hard Drive 60000 Printer Zip Drive 40000 20000 0 East North South West REGION AlamedaServices.com
  7. 7. 7What’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
  8. 8. 8To create the Pivot Table, invoke the Pivot Table Wizard with the menu commands Data, Pivot Table and Pivot Chart Report. The Pivot Table Wizard leads you through three steps: • Allows you to specify where  your data is located and Step  whether you want a chart as  well as a table.  • Most commonly you’ll get  1: your data from an Excel list  that’s part of the current  worksheet. AlamedaServices.com
  9. 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. 10Step 3: • Creates the Pivot Table using its best guess as  to layout. Use This AlamedaServices.com
  11. 11. 11If you choose the Layout button in Step 3 or invoke that view while working with the Pivot Table, you get a dialog that looks like this: AlamedaServices.com
  12. 12. 12Drag field buttons at right (representing variables from the list) to the layout diagram at left. AlamedaServices.com
  13. 13. 13Once you’ve created your Pivot Table, you can modify it by using the buttons on the Pivot Table toolbar that automatically displays. AlamedaServices.com
  14. 14. 14Pivot 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. 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 YearVector 1999 $220,000 Manufacturer 1999 2000 2001 Grand TotalNew Fashion 1999 $108,000 Desire $456,000 $460,000 $410,000 $1,326,000Young Look 1999 $300,000 Marco Polo Jeans $234,000 $280,000 $360,000 $874,000Desire 1999 $456,000 New Fashion $108,000 $100,000 $120,000 $328,000Marco Polo Jeans 1999 $234,000 Vector $220,000 $230,000 $200,000 $650,000Vector 2000 $230,000 Young Look $300,000 $302,000 $320,000 $922,000New Fashion 2000 $100,000 Grand Total $1,318,000 $1,372,000 $1,410,000 $4,100,000Young Look 2000 $302,000Desire 2000 $460,000Marco Polo Jeans 2000 $280,000Vector 2001 $200,000New Fashion 2001 $120,000Young Look 2001 $320,000Desire 2001 $410,000Marco Polo Jeans 2001 $360,000 AlamedaServices.com
  16. 16. 16When you define a Pivot Table you must identify a data field, or the variable to summarize otherwise Excel displays an error. By contrast, however, you need not define either a row or a column field. In this case, you won’t get an error message but you won’t get a very meaningful result either. Without a row and/or column “control”, Excel will return a simple table since it will have no way to summarize the data.If you specify a row field only, your Pivot Table will have one column that contains the values of the row field and another column to its right that contains the corresponding summary values for the data field. If you specify a column field only, your Pivot Table will have a top row that holds the values of the column field and a row beneath that holds the corresponding summary values of the data field. AlamedaServices.com
  17. 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,000Sum of Annual Sales Year 1999 2000 2001 Grand TotalTotal $1,318,000 $1,372,000 $1,410,000 $4,100,000 Column‐only  Pivot Table AlamedaServices.com
  18. 18. 18The Pivot Table gets its name because it’s easy to modify, or pivot (turn), the positions of the Pivot Table fields. Imagine a point at the upper left‐hand corner of the Pivot Table as the pivot point. You can drag and drop a row field up and to the right, making it a column field. And you can drag and drop a column field down and to the left, making it a row field. As mentioned earlier, although you can return to the Wizard’s layout view to accomplish this layout change, it’s easier to do it on the fly without using the Wizard. AlamedaServices.com
  19. 19. 19 Another Example Using <wine.xls> fileState Jan-2000 Feb-2000 Mar-2000 Apr-2000 May-2000 Jun-2000 Jul-2000 Sep-2000 Oct-2000 Nov-2000 Dec-2000CA 849.9 1065 1013.05 1612.6 1776.8 1426.8 1606.55 3155.7 1871.7 2014.7 1935.5MA 958 1309NJ 1256.8 1151.4 1016.4 982.6 928 1559.4 1050.6 2341.9 902.8 1163.2 923.4NY 1552.8 705 603.5 703.2 1324.9 977.4 998.9 1825.4 1172.8 970.5 1244.4Grand 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. 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 MonthState Type Jan-2000 Feb-2000 Mar-2000 Apr-2000 May-2000 Jun-2000 Jul-2000 Sep-2000 Oct-2000 Nov-2000CA 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 709CA Total 849.9 1065 1013.05 1612.6 1776.8 1426.8 1606.55 3155.7 1871.7 2014.7MA Red 591 906 White 367 403MA Total 958 1309NJ 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 377NJ Total 1256.8 1151.4 1016.4 982.6 928 1559.4 1050.6 2341.9 902.8 1163.2NY 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 342NY Total 1552.8 705 603.5 703.2 1324.9 977.4 998.9 1825.4 1172.8 970.5Grand Total 3659.5 2921.4 2632.95 4256.4 4029.7 3963.6 3656.05 7323 3947.3 5457.4 AlamedaServices.com
  21. 21. 21Pivot it!Sum of Sales MonthType State Jan-2000 Feb-2000 Mar-2000 Apr-2000 May-2000 Jun-2000 Jul-2000 Sep-2000 Oct-2000 Nov-2000Red 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.5Red Total 2364.9 1437 1433.5 2486.4 2428.9 2119 1960.2 5186.6 1753.2 3626.4White 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 342White Total 1294.6 1484.4 1199.45 1770 1600.8 1844.6 1695.85 2136.4 2194.1 1831Grand Total 3659.5 2921.4 2632.95 4256.4 4029.7 3963.6 3656.05 7323 3947.3 5457.4 AlamedaServices.com
  22. 22. 22Creating another Pivot Table based on anexisting 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
  23. 23. 23AlamedaServices.com
  24. 24. 24AlamedaServices.com
  25. 25. 25Original Pivot TableSum of Sales MonthType State Jan-2000 Feb-2000 Mar-2000 Apr-2000 May-2000 Jun-2000 Jul-2000 Sep-2000 Oct-2000Red CA 592.5 648 648 799.2 913 649 910.5 2204.2 1102.2 MA 591 NJ 606 342 342 528 466.5 750 685.2 2076.4 252 NY 1166.4 447 443.5 568.2 1049.4 720 364.5 906 399Red Total 2364.9 1437 1433.5 2486.4 2428.9 2119 1960.2 5186.6 1753.2White CA 257.4 417 365.05 813.4 863.8 777.8 696.05 951.5 769.5 MA 367 NJ 650.8 809.4 674.4 454.6 461.5 809.4 365.4 265.5 650.8 NY 386.4 258 160 135 275.5 257.4 634.4 919.4 773.8White Total 1294.6 1484.4 1199.45 1770 1600.8 1844.6 1695.85 2136.4 2194.1Grand Total 3659.5 2921.4 2632.95 4256.4 4029.7 3963.6 3656.05 7323 3947.3Pivot Table using data from the above Pivot TableSum of Quanti MonthType State 1/1/00 2/1/00 3/1/00 4/1/00 5/1/00 6/1/00 7/1/00 9/1/00 10/1/00Red CA 31 28 48 51 56 44 69 116 59 MA 28 NJ 32 17 17 42 33 36 36 112 17 NY 60 17 25 29 54 30 18 54 14Red Total 123 62 90 150 143 110 123 282 90White CA 18 21 28 55 58 59 50 65 57 MA 25 NJ 43 48 39 37 31 48 27 18 43 NY 21 18 10 9 19 18 44 62 52White Total 82 87 77 126 108 125 121 145 152Grand Total 205 149 167 276 251 235 244 427 242 AlamedaServices.com
  26. 26. 26Using Page FieldsDrag the Type Field button from the Row area to the Page area;  AlamedaServices.com
  27. 27. 27Notice that sales for all product types are shown, and that a small arrow is placed beside the (All) label next to the Type field. Click on this small arrow, a dropdown box appears that allows you to select one of the Type values (either Red or White). Try this and watch the data change to show just White or Red products.  AlamedaServices.com
  28. 28. 28Grouping DataIt is a little difficult to pick trends over the twelve month data period. Select the Month field by Clicking on the Month label on the Pivot Table. Then use menu item Data‐Group and Outline‐Group… or Click on the Group toolbar button. A dialog will ask how you wish to group the Month Field, select the Quarters option and Click Finish.  AlamedaServices.com
  29. 29. 29Sum of Sales MonthState Type Qtr1 Qtr2 Qtr3 Qtr4 Grand TotalCA Red $1,889 $2,361 $3,115 $3,955 $11,319 White $1,039 $2,455 $1,648 $1,867 $7,009CA Total $2,928 $4,816 $4,762 $5,822 $18,328MA Red $591 $906 $1,497 White $367 $403 $770MA Total $958 $1,309 $2,267NJ Red $1,290 $1,745 $2,762 $1,655 $7,451 White $2,135 $1,726 $631 $1,335 $5,826NJ Total $3,425 $3,470 $3,393 $2,989 $13,277NY Red $2,057 $2,338 $1,271 $1,670 $7,335 White $804 $668 $1,554 $1,718 $4,744NY Total $2,861 $3,006 $2,824 $3,388 $12,079Grand 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. 30 Sum of Sales Month State Group Qtr1 Qtr2 Qtr3 Qtr4 Grand Total CA Blend $330 $685 $1,021 $1,865 $3,902Creating  Melot Pinot Noir $180 $708 $378 $626 $54 $1,240 $252 $1,167 $864 $3,741another table  Riesling Semillon $668 $372 $2,135 $320 $1,558 $90 $1,124 $743 $5,485 $1,524based on  CA Total Shiraz $671 $2,928 $672 $4,816 $800 $4,762 $671 $5,822 $2,813 $18,328previous  MA Blend Pinot Noir $330 $786 $120 $1,116 $120table using  Riesling Semillon $207 $160 $403 $610 $160GROUP” 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. 31Field 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
  32. 32. 32Sum of Sales MonthState Group Qtr1 Qtr2 Qtr3 Qtr4 Grand TotalCA Blend 8.46% 17.56% 26.17% 47.81% 100.00% Melot 20.83% 43.75% 6.25% 29.17% 100.00% Pinot Noir 18.93% 16.73% 33.15% 31.19% 100.00% Riesling 12.18% 38.93% 28.41% 20.49% 100.00% Semillon 24.38% 20.99% 5.88% 48.75% 100.00% Shiraz 23.84% 23.89% 28.43% 23.84% 100.00%CA Total 15.98% 26.28% 25.98% 31.76% 100.00%MA Blend 0.00% 29.57% 0.00% 70.43% 100.00% Pinot Noir 0.00% 0.00% 0.00% 100.00% 100.00% Riesling 0.00% 33.93% 0.00% 66.07% 100.00% Semillon 0.00% 100.00% 0.00% 0.00% 100.00% Shiraz 0.00% 100.00% 0.00% 0.00% 100.00%MA Total 0.00% 42.26% 0.00% 57.74% 100.00%NJ Blend 0.00% 13.68% 70.02% 16.30% 100.00% Melot 48.15% 16.67% 0.00% 35.19% 100.00% Pinot Noir 30.58% 26.34% 28.72% 14.36% 100.00% Riesling 33.84% 27.25% 13.60% 25.31% 100.00% Semillon 47.59% 38.91% 0.00% 13.50% 100.00% Shiraz 0.00% 40.34% 20.22% 39.44% 100.00%NJ Total 25.79% 26.14% 25.55% 22.52% 100.00%NY Blend 34.46% 38.39% 15.49% 11.65% 100.00% Melot 0.00% 26.09% 26.09% 47.83% 100.00% Pinot Noir 17.07% 31.57% 12.76% 38.60% 100.00% Riesling 10.24% 18.87% 30.33% 40.57% 100.00% Semillon 36.71% 0.00% 39.87% 23.42% 100.00% Shiraz 33.33% 0.00% 33.33% 33.33% 100.00%NY Total 23.69% 24.88% 23.38% 28.05% 100.00%Grand Total 20.05% 26.66% 23.89% 29.40% 100.00% AlamedaServices.com

×