Spreadsheet-Based Decision Support Systems Chapter 6: Pivot Tables Prof. Name firstname.lastname@example.org Position (123) 456-7890 University Name
Overview • 6.1 Introduction • 6.2 Pivot Tables • 6.3 Further Modifications • 6.4 Pivot Charts • 6.5 Summary
Introduction • Creating a pivot table • Filtering for data using slicers and other pivot table features • Customizing a pivot table using several structural and formatting options • Performing advance filters using grouping, calculated fields, and the GETPIVOTDATA function • Transforming a pivot table into a pivot chart • Filtering data using a pivot chart
Pivot Tables • Terminology • Creating a Pivot Table
Pivot Tables • Transform large amounts of data from a table or database into an organized summary report • Ability to rotate and reorganize the row and column headings from your original database into this new table • Ability to filter and sort data as desired • Allows for easy searching of data
Terminology • Fields are categories of data (these may usually be row or column headings in a table) • Row Fields show each value, or item, in the field as a row • Column Fields show each value as a column heading
Terminology (cont’d) • Value Field is the main area of the table where comparative values are shown • Report Field is a larger category which can group all of the data in the table • Grand Totals and Subtotals are sum calculations that appear at the end of relative rows or columns • Field Settings are specified calculations for Grand Totals and Subtotals • Items are the values within a field
Creating a Pivot Table • Click on: Insert > Tables > PivotTable command from the Ribbon. • Three simple steps: • Step 1: Data Location • Select range of cells • Select file using Choose Connection… • Step 2: Pivot Table Location • A new worksheet • A particular area of the current worksheet • Step 3: Creating the Pivot Table • Layout
Figure 6.1 • The table contains the “Costs” for varying “Maximum Weights” and the number of “Days to Arrive” for two different “Shipping Companies.”
Figure 6.2 • The final pivot table reorganizes the data so that costs can be easily compared.
Figure 6.3 (a) • There is a drop-down arrow next to each field on the pivot table.
Figure 6.3 (b) • The updated pivot table no longer displays data for the 20+ value of “Max Weight”.
Step 1 & 2 • The data is in a Microsoft Excel table • Specify the location of the data and the location of the resulting pivot table
Step 3 • Organize our data in the pivot table: • Select and drag field names from the top to the boxes in the bottom of PivotTable Field List task pane to determine which fields become Row Fields, Column Fields, and the Value Field.
Figure 6.6 • The pivot table is created. • Use the drop-down buttons next to Column/Row Labels to filter for specific data.
Further Modifications • An Example • Pivot Table Options and Design Tools • Grouping • Calculated Fields and Items • GETPIVOTDATA Function
An Example (Figure 6.7) • Consider a data table used for Quality Control. • The number of operators, machine number, and number of units produced are recorded for three shifts.
Calculated Fields • Click on: Insert > Tables > PivotTable command, and then select PivotTable from the drop-down list. • Set “Number of Operators” and “Machine Number” as Row Fields and “Shift” as a Column Field. • Set “Units Produced” as the Value Field.
Calculated Fields • The Pivot Table Fields List can be used to further modify the pivot table layout after the pivot table has been created. • The default field setting is Sum; this affects the Grand Total and Sub Total fields. • Click on Design > Layout > Subtotal command, and then select Do Not Show Subtotal option from the drop-down list to hide row subtotals. • Click on Design > Layout > Grand Total command, and then select Off for Rows and Columns option from the drop-down list to hide row grand totals.
Field Settings • Calculate the Grand Totals for both rows and columns of the pivot table: • Click on: Design > Layout > Grand Total command. • Select: On for Rows and Columns option from the drop-dow.n list
Field Settings • Modify the Value Field Settings: • Click on: Options > Active Field > Field Settings command. • Use options listed in the Value Field Settings dialog box. • Select any of the options listed in the Summarize value field by window in the Summarize Value by tab.
Figure 6.11 • Choose Max to better analyze the combination of operators, machines, and shifts that produces the most units.
Figure 6.12 • Use options listed in the Show Values As tab in the Value Field Setting dialog box to further modify the data presentation in a pivot table. • Here we present the data in the table as a percentage of a given set of field values.
Figure 6.13 • Subtotals are Field Settings applied to Row or Column Fields. • Select the Field Settings option • Right-click in the field name • Or from the PivotTable Tools tabs on the Ribbon • Choose from the list of Custom options in the Subtotals window
Figure 6.14 • We selected the Max subtotal option to add Subtotals for the “Number of Operators” Row Field.
Pivot Table Options and Design Tools • Use commands listed in the PivotTable Toolscontextual tabs to modify the pivot table after it has been created. • The Options and Design tabs feature a number of related command buttons.
Figure 6.16 • Pivot Table Options dialog box: • Click on: Options > PivotTable > Options command. • Can be used to change • Name • Layout & Format Options • Totals & Filters • Display, etc.
Figure 6.17 • Classical Pivot Table Layout is recommended when the table has two or more row fields
Figure 6.18 • Sort & Filter grouplists commands to sort the data on a table, and insert data slicer. • Select the active field of the pivot table, and then select Options > Sort & Filter > Sort command. • Select Ascending or Descending option.
Figure 6.19 • The resulting table for “Number of Operators” in decreasing order.
Figures 6.20 and 6.21 • Slicers are visual filters of Excel. • Slicers are used to display rows/columns of a table that meet certain criteria. • Click on: Insert > Filter > Slicer command.
Figure 6.22 • Change the layout of a pivot table: • Select field “Number of Operators” (initially located at Row Labels area) and drag it to Column Labels area. • Select the “Shift” field listed under Column Labels area, and drag it to Row Labels area.
Figure 6.23 • Use the Options > Show > +/- Buttons command to expand/collapse items within a pivot table. • Example: • Activate the +/- Buttons command. • Click on the – (minus) sign next to “Machine Number” 1 and 2. The table does not display detailed information about units produced during each shift, it only displays summary results for machines 1 & 2.
Figure 6.24 • The PivotTable Styles group lists options to modify the format of a pivot table.
Grouping • Grouping items in a Row or Column Field allows you to further manipulate how you view or search for data in your pivot table. • To group field values: • Select the field • Click on: PivotTable Tools Options > Group > Group Field command, or, • Right-click on the field and select the Group options from the short-cut menu.
Calculated Fields and Items • To create a Calculated FieldorCalculated Item, click on PivotTable Tools Options > Calculations > Fields, Items & Sets from the Ribbon. • From the drop-down list that appears, select Calculated Field. • Use the dialog box to define a formula associated with the creation of a new field or item.
GETPIVOTDATA • The GETPIVOTDATA function extracts a particular set of data based values specified for each Row and Column Field. • =GETPIVOTDATA(desired_field, range_of_desired_data, field1, item1, …) • The desired_field is the field which contains the value you are searching for. • The range_of_desired_data is the range in the pivot table which contains this field. • The remaining field and item values allow you to refine your search if desired.
Pivot Charts • Click on the PivotTable Tools Options > Tools > PivotChart command on the Ribbon. • Select a chart type and subtype from the Insert Chart dialog box. • Chart is created from Pivot Table instead of initial data table • We can also create a Pivot Chart by highlighting the source data, choosing Insert > Tables > PivotTable in the Ribbon, and then selecting PivotChart from the drop-down list.
Figure 6.31 • Initial Pivot Chart
Summary • Pivot tables transform large amounts of data from a table or database into an organized summary report. • The three steps to create a pivot table are: Data Location, Pivot Table Location, and Create Table Layout with specified options. • Insert Slicers when you want to display only rows of your table that meet certain criteria. • Use Grouping to create intervals in field values. • You can create Calculated Fields or Calculated Items to further analyze the data in your table. • GETPIVOTDATA searches for data in a pivot table using field value criteria. • Pivot Charts use pivot tables as their Source Data so that filtering options are transferred to the chart as well.
Additional Links • (place links here)