Chapter 2
In This Chapter
Analyzing worksheet data with pivot tables and pivot charts
Analyzing worksheet data with the PowerPivot and Power View add-ins
Analyzing data visually over time with Power Map
Analyzing data trends in a visual forecast worksheet
The subject of this chapter is performing data analysis on a larger scale in Excel 2016 worksheets, often with visual components that enable you and your users to immediately spot developing trends. The primary Excel tool for performing such large-scale analysis on your worksheet data is the pivot table and its visual counterpart, the pivot chart. Pivot tables enable you to quickly summarize large amounts of data revealing inherent relationships and trends, whereas pivot charts enable you to easily visualize these connections.
In addition, you have access to Excel’s PowerPivot and Power View add-ins when you need to perform analysis on really large data models whose tables contain really huge amounts of data. Finally, Excel 2016 offers you two brand new data analysis features designed to help you quickly identify significant indicators of your business’s health and well-being: Power Map, which produces stunning, interactive 3-D maps animating data over time, and Forecast Sheet, which generates worksheets showing developing trends in your data.
Pivot table is the name given to a special type of data summary table that you can use to analyze and reveal the relationships inherent in the data lists that you maintain in Excel. Pivot tables are great for summarizing particular values in a data list or database because they do their magic without making you create formulas to perform the calculations. Unlike the Subtotals feature, which is another summarizing feature (see Book VI, Chapter 1 for more information), pivot tables let you play around with the arrangement of the summarized data — even after you generate the table. (The Subtotals feature only lets you hide and display different levels of totals in the list.) This capability to change the arrangement of the summarized data by rotating row and column headings gives the pivot table its name.
Pivot tables are also versatile because they enable you to summarize data by using a variety of summary functions (although totals created with the SUM function will probably remain your old standby). You can also use pivot tables to cross-tabulate one set of data in your data list with another. For example, you can use this feature to create a pivot table from an employee database that totals the salaries for each job category cross-tabulated (arranged) by department or job site. Moreover, Excel 2016 makes it easy to create pivot tables that summarize data from more than one related data list entered in the worksheet or retrieved from external data in what’s known as a Data Model. (See Book VI, Chapter 2 for more on relating data lists and retrieving external data.)
Excel 2016 offers several methods for creating new pivot tables in your worksheets:
Excel 2016 makes it simple to create a new pivot table using a data list selected in your worksheet with its new Quick Analysis tool. To preview various types of pivot tables that Excel can create for you on the spot using the entries in a data list that you have open in an Excel worksheet, simply follow these steps:
Select all the data (including the column headings) in your data list as a cell range in the worksheet.
If you’ve assigned a range name to the data list, you can select the column headings and all the data records in one operation simply by choosing the data list’s name from the Name box drop-down menu.
Click the Quick Analysis tool that appears right below the lower-right corner of the current cell selection.
Doing this opens the palette of Quick Analysis options with the initial Formatting tab selected and its various conditional formatting options displayed.
Click the Tables tab at the top of the Quick Analysis options palette.
Excel selects the Tables tab and displays its Table and PivotTable option buttons. The Table button previews how the selected data would appear formatted as a table. The other PivotTable buttons preview the various types of pivot tables that can be created from the selected data.
To preview each pivot table that Excel 2016 can create for your data, highlight its PivotTable button in the Quick Analysis palette.
As you highlight each PivotTable button in the options palette, Excel’s Live Preview feature displays a thumbnail of a pivot table that can be created using your table data. This thumbnail appears above the Quick Analysis options palette for as long as the mouse or Touch pointer is over its corresponding button.
When a preview of the pivot table you want to create appears, click its button in the Quick Analysis options palette to create it.
Excel 2016 then creates the previewed pivot table on a new worksheet that is inserted at the beginning of the current workbook. This new worksheet containing the pivot table is active so that you can immediately rename and relocate the sheet as well as edit the new pivot table, if you wish.
Figures 2-1 and 2-2 show you how this procedure works. In Figure 2-1, I’ve highlighted the fourth suggested PivotTable button in the Quick Analysis tool’s option palette. The previewed table in the thumbnail displayed above the palette shows the salaries subtotals and grand totals in the Employee Data list organized whether or not the employees participate in profit sharing (Yes or No).
Figure 2-2 shows you the pivot table that Excel created when I clicked the highlighted button in the options palette in Figure 2-1. Note this pivot table is selected on its own worksheet (Sheet1) that’s been inserted in front of the Employee Data worksheet. Because the new pivot table is selected, the PivotTable Fields task pane is displayed on the right side of the Excel worksheet window and the PivotTable Tools context tab is displayed on the Ribbon. You can use the options on this task pane and contextual tab to then customize your new pivot table as described in the “Formatting a Pivot Table” section later in this chapter.
If creating a new pivot table with the Quick Analysis tool (described in the previous section) is too much work for you, you can quickly generate a pivot table with the new Recommended Pivot Tables command button. To use this method, follow these three easy steps:
Select a cell in the data list for which you want to create the new pivot table.
Provided that the data list has a row of column headings with contiguous rows of data as described in Book VI, Chapter 1, this can be any cell in the table.
Click the Recommended PivotTables command button on Insert tab of the Ribbon or press Alt+NSP.
Excel displays a Recommended PivotTables dialog box similar to the one shown in Figure 2-3. This dialog box contains a list box on the left side that shows samples of all the suggested pivot tables that Excel 2016 can create from the data in your list.
As soon as you select OK, Excel creates a new pivot table following the selected sample on its own worksheet inserted in front of the others in your workbook. This pivot table is selected on the new sheet so that the Pivot Table Fields task pane is displayed on the right side of the Excel worksheet window and the PivotTable Tools contextual tab is displayed on the Ribbon. You can use the options on this task pane and contextual tab to then customize your new pivot table as described in the “Formatting a Pivot Table” section later in this chapter.
Creating pivot tables with the Quick Analysis tool or the Recommended PivotTables button on the Insert tab is fine provided that you’re only summarizing the data stored in a single data list that’s stored in your Excel worksheet.
When you want your pivot table to work with data from fields in more than one (related) data table or with data stored in a data table that doesn’t reside in your worksheet as when connecting with an external data source (see Book VI, Chapter 2), you need to manually create the pivot table.
To manually create a new pivot table using a data list stored in your Excel workbook, simply open the worksheet that contains that list (see Book VI, Chapter 1) you want summarized by the pivot table, position the cell pointer somewhere in the cells of this list, and then click the PivotTable command button on the Ribbon’s Insert tab or press Alt+NVT.
Excel then selects all the data in the list indicated by a marquee around the cell range before it opens a Create PivotTable dialog box similar to the one shown in Figure 2-4, where the Select a Table or Range option is selected. You can then adjust the cell range in the Table/Range text box under the Select a Table or Range option button if the marquee does not include all the data to be summarized in the pivot table.
By default, Excel builds the new pivot table on a new worksheet it adds to the workbook. If you want the pivot table to appear on the same worksheet, select the Existing Worksheet option button and then indicate the location of the first cell of the new table in the Location text box. (Just be sure that this new pivot table isn’t going to overlap any existing tables of data.)
If you’re creating a pivot table using external data not stored in your workbook, you want to locate the cell pointer in the first cell of the worksheet where you want the pivot table before opening the Create PivotTable dialog box by selecting the PivotTable button on the Insert tab.
When the cell pointer’s in a blank cell when you open the Create PivotTable dialog box, Excel automatically selects the Use an External Data Source option as the data source and the Existing Worksheet option as the location for the new pivot table. To specify the external data table to use, you then click the Choose Connections button to open the Existing Connections dialog box, where you select the name of the connection you want to use before you click the Open button. (See Book VI, Chapter 2 for information on establishing connections with external database tables.)
Excel then returns you to the Create PivotTable dialog box, where the name of the selected external data connection is displayed after the Connection Name heading. You can then modify the location settings, if need be, before creating the new pivot table by clicking OK. Note that the Add This Data to the Data Model check box is automatically selected (and cannot be deselected) — the relationships between the data tables in the source database specified by the external data connection are automatically reflected in fields displayed in the Field list for the new pivot table.
After you indicate the source and location for the new pivot table in the Create PivotTable dialog box and click its OK button, the program adds a placeholder graphic (with the text, “To build a report, choose fields from the PivotTable Field List”) indicating where the new pivot table will go in the worksheet while at the same time displaying a PivotTable Fields task pane on the right side of the Worksheet area. (See Figure 2-5.)
This PivotTable Fields task pane is divided into two areas: the Choose Fields to Add to Report list box with the names of all the fields in the data list you selected as the source of the table preceded by an empty check box at the top, and an area identified by the heading, Drag Fields Between Areas Below, which is divided into four drop zones (FILTERS, COLUMNS, ROWS, and VALUES) at the bottom.
To complete the new pivot table, all you have to do is assign the fields in the PivotTable Fields task pane to the various parts of the table. You do this by dragging a field name from the Choose Fields to Add to Report list box to one of the four areas (or drop zones) in the Drag Fields Between Areas Below section at the bottom of the task pane:
To better understand how you can use these various areas in a pivot table, look at a completed pivot table in Figure 2-6. For this pivot table, I dragged these fields in the employee data list to the following areas in the PivotTable Fields task pane:
As a result, this pivot table now displays the sum of the salaries for both the men and women employees in each location (across the columns) and then presents these sums by their department (in each row).
As soon as you create a new pivot table (or select the cell of an existing table in a worksheet), Excel selects the Analyze tab of the PivotTable Tools contextual tab added to the end of the Ribbon. Among the many groups on this tab, you find the Active Field group, which contains the following useful command buttons:
Excel 2016 makes formatting a new pivot table you’ve added to a worksheet as quick and easy as formatting any other table of data or list of data. All you need to do is click a cell of the pivot table to add the PivotTable Tools contextual tab to the end of the Ribbon and then click its Design tab to display its command buttons.
The Design tab on the PivotTable Tools contextual tab is divided into three groups:
After selecting a style from the PivotTable Styles gallery on the Design tab on the PivotTable Tools contextual tab, you can then refine the style using the command buttons in the Layout group and the check boxes in the PivotTable Style Options group.
The Layout group on the Design tab contains the following four command buttons:
The PivotTable Style Options group contains the following four check boxes:
Figure 2-7 shows the original pivot table created from the employee data list after making the following changes:
Even after applying a table style to your new pivot table, you may still want to make some individual adjustments to its formatting, such as selecting a new font, font size, or cell alignment for the text of the table and a new number format for the values in the table’s data cells.
You can make these types of formatting changes to a pivot table by selecting the part of the table to which the formatting is to be applied and then selecting the new formatting from the appropriate command buttons in the Font, Alignment, and Number groups on the Home tab of the Ribbon.
You can modify the text in a pivot table by selecting a new font, font size, or horizontal alignment. To make these formatting changes to the text in the entire table, select the entire table before you use the appropriate command buttons in the Font and/or Alignment group on the Home tab. To apply these changes only to the headings in the pivot table, select only its labels before using the commands on the Home tab. To apply these changes only to the data in the body of the pivot table, select only its cells.
To help you select the cells you want to format in a pivot table, use the following Select items on the Actions command button’s drop-down list:
When you first create a pivot table, Excel does not format the data cells in the table that contain the values corresponding to the field or fields you add to the VALUES area in the PivotTable Fields task pane and the subtotals and grand totals that Excel adds to the table. You can, however, assign any of the Excel number formats to the values in the pivot table in one of two manners.
In the first method, you select the entire table (Alt+JTWT), then select only its data cells in the body of the pivot table (Alt+JTWV), and then apply the desired number format using the command buttons in the Number group of the Home tab of the Ribbon. For example, to format the data cells with the Accounting number format with no decimal places, you click the Accounting Number Format command button and then click the Decrease Decimal command button twice.
You can also apply a number format to the data cells in the body of the pivot table by following these steps:
Click the name of the field in the pivot table that contains the words “Sum of” and then click the Field Settings button in the Active Field group of Analyze tab to open the Summarize Values By tab of the Value Field Settings dialog box.
In my Employee example pivot table, this field is called Sum of Salary because the Salary field is summarized. Note that this field is located at the intersection of the Column and Row Label fields in the table.
When you create a new pivot table, you’ll notice that Excel automatically adds AutoFilter buttons to the Report Filter field as well as the labels for the Column and Row fields. These AutoFilter buttons enable you to filter out all but certain entries in any of these fields, and in the case of the Column and Row fields, to sort their entries in the table.
When you add more than one Column or Row field to your pivot table, Excel adds collapse buttons (–) that you can use to temporarily hide subtotal values for a particular secondary field. After clicking a collapse button in the table, it immediately becomes an expand button (+) that you can click to redisplay the subtotals for that one secondary field.
Perhaps the most important AutoFilter buttons in a pivot table are the ones added to the Report Filter field(s). By selecting a particular option on the drop-down lists attached to one of these AutoFilter buttons, only the summary data for that subset you select is then displayed in the pivot table itself.
For example, in the example pivot table (refer to Figure 2-6) that uses the Gender field from the employee data list as the Report Filter field, you can display the sum of just the men’s salaries by location and department in the body of the pivot table simply by clicking the Gender field’s filter button and then selecting M from the drop-down list before you click OK. Likewise, you can view the summary of the women’s salaries by selecting F from this filter button’s drop-down list. To later redisplay the summary of the salaries for all the employees, you then reselect the (All) option from this list before you click OK.
Excel then displays M in the Gender Report Filter field instead of the default (All) and replaces the standard drop-down button icon with a cone-shaped filter icon, indicating that the field is currently being filtered to show only some of the values in the data source.
The AutoFilter buttons on the Column and Row fields enable you to filter particular groups and, in some cases, individual entries in the data source. To filter the summary data in the columns or rows of a pivot table, click the Column or Row field’s filter button and start by deselecting the check box for the (Select All) option at the top of the drop-down list to clear its check mark. Then, select the check boxes for all the groups or individual entries whose summed values you still want displayed in the pivot table to put check marks back in each of their check boxes before you click OK.
As when filtering a Report Filter field in the table, Excel replaces the standard drop-down button icon displayed in the particular Column or Report field with a cone-shaped filter icon. This icon indicates that the field is currently being filtered and only some of its summary values are now displayed in the pivot table. To redisplay all the values for a filtered Column or Report field, you need to click its filter button and then select the (Select All) option at the top of its drop-down list before you click OK.
Figure 2-8 shows the original sample pivot table after formatting the values (with a number format that uses a comma as a thousands separator and displays zero decimal places) and then filtering its Gender Filter Report Field to women by selecting F (for Female) and its Dept Row Field to Accounting, Administration, and Human Resources.
Excel 2016 supports slicers, a graphic tool for filtering the data in your pivot table. Instead of having to filter the data using the check boxes attached to an item list on the drop-down menus on a field’s AutoFilter button, you can use slicers instead. Slicers, which float as graphic objects over the worksheet, not only enable you to quickly filter the data in particular fields of a pivot table, but also enable you to connect slicers to multiple pivot tables or to a pivot table and a pivot chart you’ve created.
To use slicers on a pivot table, click one of the table’s cells and then click the Insert Slicer button in the Filter group of the table’s Analyze tab. Excel then displays an Insert Slicers dialog box containing a list of all the fields in the current pivot table. You then select the check boxes for all the fields you want to filter the pivot table for before you select OK.
Excel then displays a slicer for each field you select in the Insert Slicers dialog box. Each slicer appears as a rectangular graphic object that contains buttons for each entry in the particular pivot table field. You can then filter the data in the pivot table simply by clicking the individual entries in the slicer for all the values you still want displayed in the table. To display values for multiple, nonconsecutive entries in a particular field, you hold down the Ctrl key as you click entries in its slicer. To display values of multiple consecutive values, you click the first entry in its slicer and then hold the Shift key as you click the last entry you want included.
Figure 2-9 shows you the pivot table for the employee data list after I used three slicers to filter it. The first slicer is for the Gender field, where I selected M so that only the records for the men are displayed in the pivot table. The second slicer is for the Dept field, where I clicked the Engineering item to display only the men’s salaries in Engineering. The third and final slicer is for the Location field, where I selected the Chicago, San Francisco, and Seattle locations (by holding down the Ctrl key as I clicked their buttons in the Location slicer). As a result, the employee data pivot table is now filtered so that you see only the salary totals for the men in the Engineering departments at the Chicago, San Francisco, and Seattle offices.
To move a slicer, you click it to select it and then drag it from somewhere on its border using the black-cross pointer with an arrowhead. To deselect the items you’ve selected in a slicer, click the button in the upper-right corner of the slicer with a red x through the filter icon. To get rid of a slicer (and automatically redisplay the PivotTable Fields task pane), select the slicer and then press the Delete key.
Excel 2016 also enables you to filter your data with its timeline feature. You can think of timelines as slicers designed specifically for date fields that enable you to filter data out of your pivot table that doesn’t fall within a particular period, thereby allowing you to see timing of trends in your data.
To create a timeline for your pivot table, select a cell in your pivot table and then select the Insert Timeline button in the Filter group on the Analyze contextual tab under the PivotTable Tools tab on the Ribbon. Excel then displays an Insert Timelines dialog box displaying a list of pivot table fields that you can use in creating the new timeline. After selecting the check box for the date field you want to use in this dialog box, click OK.
Figure 2-10 shows you the timeline I created for the sample Employee Data list by selecting its Date Hired field in the Insert Timelines dialog box. As you can see, Excel created a floating Date Hired timeline with the years and months demarcated and a bar that indicates the time period selected. By default, the timeline uses months as its units, but you can change this to years, quarters, or even days by clicking the time units’ drop-down button immediately below the filter icon in the upper-right corner of the timeline and then selecting the desired time unit.
For Figure 2-10, I selected the Years option as the timeline’s unit and then selected the period 1995 through 1999 so that the pivot table shows the salaries by department and location for only employees hired during this four-year period. I did this simply by dragging the timeline bar in the Date Hired timeline graphic so that it begins at 1995 and extends just up to 2000. And should I need to filter the pivot table salary data for other hiring periods, I would simply modify the start and stop times by dragging the timeline bar in the Date Hired timeline.
You can instantly reorder the summary values in a pivot table by sorting the table on one or more of its Column or Row fields. To re-sort a pivot table, click the AutoFilter button for the Column or Row field you want to use in the sort and then click either the Sort A to Z option or the Sort Z to A option at the top of the field’s drop-down list.
Click the Sort A to Z option when you want the table reordered by sorting the labels in the selected field alphabetically, or, in the case of values, from the smallest to largest value, or, in the case of dates, from the oldest to newest date. Click the Sort Z to A option when you want the table reordered by sorting the labels in reverse alphabetical order (Z to A), values from the highest to smallest, and dates from the newest to oldest.
As the term pivot implies, the fun of pivot tables is being able to rotate the data fields by using the rows and columns of the table, as well as to change what fields are used on the fly. For example, suppose that after making the data list’s Location field the pivot table’s Column Labels Field, and its Dept field the Row Labels Field, you now want to see what the table looks like with the Dept field as the Column Labels Field and the Location field as the Row Labels Field.
No problem: All you have to do is open the PivotTable Fields task pane (Alt+JTL) and then drag Location from the COLUMNS area to the ROWS area and then drag Dept from the ROWS to COLUMNS. Voilà — Excel rearranges the totaled salaries so that the rows of the pivot table show the location grand totals, and the columns now show the departmental grand totals. Figure 2-11 shows this new arrangement for the pivot table.
In fact, when pivoting a pivot table, not only can you rotate existing fields, but you can also add new fields to the pivot table or assign more fields to the table’s COLUMNS and ROWS areas.
Figure 2-12 illustrates this situation. This figure shows the same pivot table after making a couple of key changes to the table structure. First, I added the Profit Sharing field as a second Report Filter field by dragging it to the FILTERS area in the PivotTable Fields task pane. Then, I made Location a second Row Labels Field by dragging it from the COLUMNS area to the ROWS area. Finally, for this figure, I changed the setting in the Gender Report Filter from the default of All to M and changed the Profit Sharing Report Filter to Yes.
As a result, the modified pivot table shown in Figure 2-12 now shows the salary totals for all the men in the corporation arranged first by their department and then by their location. Because I added Profit Sharing as a second Report Filter, I can see the totals for just the men or just the women who are or aren’t currently enrolled in the profit sharing plan simply by selecting the appropriate Report Filter settings.
By default, Excel uses the good old SUM function to total the values in the numeric field(s) that you add to the VALUES area, thereby assigning them to the data cells in the body of the pivot table. Some data summaries require the use of another summary function, such as the AVERAGE or COUNT function.
To change the summary function that Excel uses, you open the Field Settings dialog box for one of the fields that you use as the data items in the pivot table. You can do this either by clicking the Value Field Settings option on the field’s drop-down menu in the VALUES area in the PivotTable Fields task pane (Alt+JTL) or by right-clicking the field’s label and then selecting Value Field Settings on its shortcut menu.
After you open the Value Field Settings dialog box for the field, you can change its summary function from the default Sum to any of the following functions by selecting it on the Summarize By tab:
After you select the new summary function to use on the Summarize By tab of the Value Field Settings dialog box, click the OK button to have Excel apply the new function to the data presented in the body of the pivot table.
In addition to using various summary functions on the data presented in your pivot table, you can create your own Calculated Fields for the pivot table. Calculated Fields are computed by a formula that you create by using existing numeric fields in the data source. To create a Calculated Field for your pivot table, follow these steps:
Click any of the cells in the pivot table and then select the Calculated Field option from the Fields, Items, & Sets button’s drop-down list on the Analyze tab or press Alt+JTJF.
The Fields, Items, & Sets command button is found in the Calculations group on Analyze tab on the PivotTable Tools contextual tab.
Excel opens the Insert Calculated Field dialog box similar to the one shown in Figure 2-13.
Enter the name for the new field in the Name text box.
Next, you create the formula in the Formula text box by using one or more of the existing fields displayed in the Fields list box.
Click the Formula text box and then delete the zero (0) after the equal sign and position the insertion point immediately following the equal sign (=).
Now you’re ready to type in the formula that performs the calculation. To do this, insert numeric fields from the Fields list box and indicate the operation to perform on them with the appropriate arithmetic operators (+, -, *, or /).
Enter the formula to perform the new field’s calculation in the Formula text box, inserting whatever fields you need by clicking the name in the Fields list box and then clicking the Insert Field button.
For example, in Figure 2-13, I created a formula for the new calculated field called Bonus that multiplies the values in the Salary Field by 2.5 percent (0.025) to compute the total amount of annual bonuses to be paid. To do this, I selected the Salary field in the Fields list box and then clicked the Insert Field button to add Salary to the formula in the Formula text box (as in =Salary). Then, I typed *0.025 to complete the formula (=Salary*0.025).
When you finish entering the formula for your calculated field, you can add the calculated field to the PivotTable Fields task pane by clicking the Add button. After you click the Add button, it changes to a grayed-out Modify button. If you start editing the formula in the Formula text box, the Modify button becomes active so that you can click it to update the definition.
Click OK in the Insert Calculated Field dialog box.
This action closes the Insert Calculated Field dialog box and adds the summary of the data in the calculated field to your pivot table.
After you finish defining a calculated field to a pivot table, Excel automatically adds its name to the field list in the PivotTable Fields task pane and to the VALUES area thereby assigning the calculated field as another Data item in the body of the pivot table.
You can use the PivotTable Options dialog box (shown in Figure 2-14) to change the settings applied to any and all pivot tables that you create in a workbook. You open this dialog box by clicking the PivotTable command button on the PivotTable Tools tab’s Analyze tab followed by the Options menu item on the Options drop-down button or by simply pressing Alt+JTTT.
The PivotTable Options dialog box contains the following six tabs:
Instead of generating just a plain old boring pivot table, you can spice up your data summaries quite a bit by generating a pivot chart to go along with a supporting pivot table. To create a pivot chart from your pivot table, simply follow these two steps:
Click the PivotChart command button in the Tools group on the Analyze tab under the PivotTable Tools contextual tab or press Alt+JTC.
Excel opens the Insert Chart dialog box where you can select the type and subtype of the pivot chart you want to create. (See Book V, Chapter 1.)
As soon as you click OK after selecting the chart subtype, Excel inserts an embedded pivot chart into the worksheet containing the original pivot table. This new pivot chart contains drop-down buttons for each of the four different types of fields used in the pivot chart (Report Filter, Legend Fields, Axis Fields, and Values). You can use these drop-down buttons to sort and filter the data represented in the chart. (See “Filtering a pivot chart” later in this chapter for details.)
In addition, Excel replaces the PivotTable Tools on the Ribbon with a PivotChart Tools contextual tab. This PivotChart Tools tab is then further subdivided into three tabs: Analyze, Design, and Format, which is automatically selected.
Although Excel automatically creates all new pivot charts on the same worksheet as the pivot table, you may find customizing and working with the pivot chart easier if you move the chart to its own chart sheet in the workbook. To move a new pivot chart to its own chart sheet in the workbook, follow these steps:
Click the Analyze tab under the PivotChart Tools contextual tab to bring its tools to the Ribbon and then click the Move Chart command button or press Alt+JTV.
Excel opens the Move Chart dialog box.
Figure 2-15 shows a clustered column pivot chart after moving the chart to its own chart sheet in the workbook.
When you graph the data in a pivot table using a typical chart type such as column, bar, or line that uses both an x- and y-axis, the Row labels in the pivot table appear along the x- or category-axis at the bottom of the chart and the Column labels in the pivot table become the data series that are delineated in the chart’s legend. The numbers in the Values field are represented on the y- or value-axis that goes up the left side of the chart.
When you generate a new pivot chart, Excel adds drop-down list buttons to each of the types of fields represented. You can then use these drop-down buttons in the pivot chart itself to filter the charted data represented in this fashion like you do the values in the pivot table. Remove the check mark from the (Select All) or (All) option and then add a check mark to each of the fields you still want represented in the filtered pivot chart.
Click the following drop-down buttons to filter a different part of the pivot chart:
The command buttons on the Design and Format tabs attached to the PivotChart Tools contextual tab make it easy to further format and customize your pivot chart. Use the Design tab buttons to select a new chart style for your pivot chart or even a brand-new chart type and further refine your pivot chart by adding chart titles, text boxes, and gridlines. Use the Format tab’s buttons to refine the look of any graphics you’ve added to the chart as well as select a new background color for your chart.
The PowerPivot add-in, first introduced in Excel 2010, enables you to efficiently work with and analyze large datasets (such as those with hundreds of thousands or even millions of records) has been made a much more integral part of Excel 2016. In fact, the Power Pivot technology that makes it possible for Excel to easily manage massive amounts of data from many related data tables is now part and parcel of Excel 2016 in the form of its Data Model feature. This means that you don’t even have to trot out and use the Power Pivot add-in in order to be able to create Excel pivot tables that utilize tons of data records stored in multiple, related data tables. (See Book VI, Chapter 2 for details.)
If you do decide that you want to use Power Pivot in managing large datasets and doing advanced data modeling in your Excel pivot tables, instead of having to download the add-in from the Microsoft Office website, you can start using Power Pivot simply by activating the add-in as follows:
Choose File ⇒ Options ⇒ Add-Ins or press Alt+FTAA.
Excel opens the Add-Ins tab of the Excel Options dialog box with Excel Add-Ins selected in the Manage drop-down list.
Click the Manage drop-down list button and then select COM Add-Ins from the drop-down list before you select the Go button.
Excel displays the COM Add-Ins dialog box that contains (as of this writing) the following COM (Component Object Model) add-ins: Inquire, Microsoft Power Map for Excel, Microsoft Power Pivot for Excel, and Microsoft Power View for Excel.
Select the check box in front of Microsoft Office Power Pivot for Excel 2016 and then click OK.
Excel closes the COM Add-Ins dialog box and returns you to the Excel 2016 worksheet window that now contains a Power Pivot tab at the end of the Ribbon.
Power Pivot makes it easy to perform sophisticated modeling with the data in your Excel pivot tables. To open the Power Pivot for Excel window, you click the Manage button in the Data Model group on the Power Pivot tab shown in Figure 2-16 or press Alt+BM.
If your workbook already contains a pivot table that uses a Data Model created with external data already imported in the worksheet (see Book VI, Chapter 2 for details) when you select the Manage button, Excel opens a Power Pivot for Excel window similar to the one shown in Figure 2-17. This window contains tabs at the bottom for all the data tables that you imported for use in the pivot table. You can then review, filter, and sort the records in the data in these tables by selecting their respective tabs followed by the appropriate AutoFilter or Sort command button. (See Book VI, Chapter 1 for details.)
If you open the Power Pivot for Excel window before importing the external data and creating your pivot table in the current Excel workbook, the Power Pivot window is empty of everything except the Ribbon with its three tabs: Home, Design, and Advanced. You can then use the Get External Data button on the Home tab to import the data tables that make your Data Model.
The options attached to the Power Pivot Get External Data button’s drop-down menu are quite similar to those found on the Get External Data button on the Excel Data tab:
After you select the source of your external data using one of the options available from the Power Pivot window’s Get External Data button, Excel opens a Table Import Wizard with options appropriate for defining the database file or server (or both) that contains the tables you want imported. Be aware that, when creating a connection to import data from most external sources (except for other Excel workbooks and text files), you’re required to provide both a recognized username and password.
Diagram View is among the most useful features for data modeling offered by the Excel 2016 PowerPivot add-in. When you switch from the default Data View to Diagram View either by clicking the Diagram View button on the Ribbon or the Diagram button in the lower-right corner to the right of the Display button, all the data tables used in the Data Model are graphically displayed in the PowerPivot window. (See Figure 2-18.)
Each data table graphic object is labeled by name on its title bar and displays within it a list of all its fields. To see all the fields within a particular table, you may have to resize it by dragging the mouse or Touch pointer at its corners or midpoints. To avoid obscuring a data table below when enlarging a table located above it to display more of its fields, you can move either the upper or lower data table out of the way by dragging it by its title bar.
In addition to graphic representations of all data tables in the current Data Model, the Diagram View shows all existing relationships between them. It does this by drawing connecting lines between each of the related tables. The data table containing the primary key field is indicated by a dot at the end of its connecting line and the table containing the foreign key by an arrowhead at the end of its line. To see the name of the key field in each related table, simply click the connecting line: Power Pivot then selects the fields in both tables indicated by surrounding them with blue outlines.
Not only can you easily review the relationships between data tables in Diagram View, but you can also modify them. The most usual way is to create relationships between unrelated tables by locating their key fields and then literally drawing a line between the tables. To locate fields shared by two data tables in the Power Pivot diagram in either a one-to-one or one-to-many relationship, you can expand the data table graphics to display the entire list of their fields as well as use the Zoom slider at the top of the window beneath the Ribbon to zoom in and out on the tables. (To see all the tables at once, click the Fit to Screen button to the immediate left of the Zoom slider.)
In addition to visually locating shared fields, you can also use PowerPivot’s search feature (by clicking the Find button on the Home tab) to search for particular field names. When you locate two tables that share a field that might work as a key field, you can relate them simply by dragging a line from the potential key field in one table to the key field in the other. When you release the mouse button or remove your finger or stylus on a touchscreen device, Excel draws a blue outline between the tables indicating the new relationship based on the two shared fields.
DAX stands for Data Analysis Expression and is the name of the language that Power Pivot for Excel uses to create calculations between the columns (fields) in your Excel Data Model. Fortunately, creating a calculation with DAX is more like creating an Excel formula that uses a built-in function than it is like using a programming language such as VBA or HTML.
This similarity is underscored by the fact that all DAX expressions start with an equal sign just like all standard Excel formulas and that as soon as you start typing the first letters of the name of a DAX function you want to use in the expression you’re building, an Insert Function–like drop-down menu with all the DAX functions whose names start with those same letters appears. And as soon as you select the DAX function you want to use from this menu, PowerPivot not only inserts the name of the DAX function on the PowerPivot Formula bar (which has the same Cancel, Enter, and Insert Function buttons as the Excel Formula bar), but also displays the complete syntax of the function, showing all the required and optional arguments of that function immediately below the Formula bar.
In addition to using DAX functions in the expressions you create for calculated columns in your Data Model, you can also create simpler expressions using the good old arithmetic operators that you know so well from your Excel formulas (+ for addition, – for subtraction, * for multiplication, / for division, and so on).
To create a calculated column for your Data Model, PowerPivot must be in Data View. (If you’re in Diagram View, you can switch back by clicking the Data View command button on the Power Pivot window’s Home tab or by clicking the Grid button in the lower right corner of the PowerPivot window.) When Power Pivot for Excel is in Data View, you can create a new calculated field by following these steps:
Click the Add button on the Design tab of the Power Pivot Ribbon.
Power Pivot adds a new column at the end of the current data table with the generic field name, Add Column.
Type = (equal sign) to begin building your DAX expression.
PowerPivot activates its Formula bar where it inserts the equal to sign.
Build your DAX expression on the Power Pivot Formula bar more or less as you build an Excel formula in a cell of one of its worksheets.
To use a DAX function in the expression, click the Insert Function button on the Power Pivot Formula bar and select the function to use in the Insert Function dialog box (which is very similar to the standard Excel Insert Function dialog box except that it contains only DAX functions). To define an arithmetic or text calculation between columns in the current data table, you select the columns to use by clicking them in the data table interspersed with the appropriate operator. (See Table 1-1 in Book III, Chapter 1 for a complete list of operators.)
To select a field to use in a calculation or as an argument in a DAX function, click its field name at the top of its column to add it to the expression on the Power Pivot Formula bar. Note that Power Pivot automatically encloses all field names used in DAX expressions in a pair of square brackets as in
=[UnitPrice]*[Quantity]
where you’re building an expression in an extended price calculated column that multiplies the values in the UnitPrice field by those in the Quantity field of the active data table.
As soon as you click the Enter button, Power Pivot performs the calculations specified by the expression you just created, returning the results to the new column. (This may take several moments depending upon the number of records in the data table.) As soon as Power Pivot completes the calculations, the results appear in the cells of the Add Column field. You can then rename the column by double-clicking its Add Column generic name, typing in the new field name, and pressing Enter.
After creating a calculated column to your data table, you can view its DAX expression simply by clicking its field name at the top of its column in the Power Pivot Data View. If you ever need to edit its expression, you can do so simply by clicking the field name to select the entire column and then click the insertion point in the DAX expression displayed on the PowerPivot Formula bar. If you no longer need the calculated column in the pivot table for its Data Model, you can remove it by right-clicking the column and then selecting Delete Columns on its shortcut menu. If you simply want to hide the column from the Data View, you select the Hide from Client Tools item on this shortcut menu.
Power View is another COM (Component Object Model) add-in that comes with most versions of Excel 2016. This add-in works with Power Pivot for Excel 2016 to enable you to create visual reports for your Excel Data Model.
To use the Power View add-in to create a visual report for the Data Model represented in your Excel pivot table, click the Power View button on the Insert tab of the Excel Ribbon. Excel then opens a new Power View sheet (with the generic sheet name, Power View1) while at the same time displaying a Power View tab on the Ribbon and the Power View Fields task pane on the right-hand side of the window. (See Figure 2-19.)
You then select the fields from related tables listed in the Power View Fields task pane that you want visually represented in the Power View report. Power View then displays the data for the selected fields graphically as small tables on the Power View worksheet, while at the same time selecting a Design tab on the Ribbon that contains a Switch Visualization group with these options:
Figure 2-19 shows a prime example of the kind of visual report that you might want to create with the Power View add-in. The map on this Power View worksheet shows the total sales geographically with different sized circles that represent the relative sales in that region. When you position the mouse or Touch pointer on one of the circles in this Power View report, Excel displays a text box containing the name of the region followed by the total amount of its sales.
To create this Power View report, you simply select the SalesAmount field in the FactSales data table as well as the ZipCode field in the related Range data table. (These two tables are related in a one-to-many relationship using a StoreKey field that is primary in FactSales data table and foreign in the Range data table.)
After selecting these two fields in the Power View Fields task pane of the Power View worksheet by clicking their field names after expanding their tables in the list, I created the visual report shown in Figure 2-19 simply by clicking somewhere in the table to select it and then clicking the Map option in the Switch Visualization group of the Design tab and then replacing the generic, Click Here to Add a Title, with the Aggregated Sales by Country label shown there.
Power Map is the name of an exciting new visual analysis feature in Excel 2016 that enables you to use geographical, financial, and other types of data along with date and time fields in your Excel data model to create animated 3-D map tours.
To create a new animation for the first tour in Power Map, you follow these general steps:
Position the cell cursor in one of the cells in the data list and then click Insert ⇒ Map ⇒ Open Power Map (Alt+NSMO) on the Excel Ribbon.
Excel opens a Power Map window with a new Tour (named Tour 1) with its own Ribbon with a single Home tab similar to the one shown in Figure 2-20. This window is divided into three panes. The Layer pane on the right contains an outline of the default Layer 1 with three areas: Data, Filters, and Layer Options. The Data area in the Layer Pane is automatically expanded to display a Location, Height, Category, and Time list box. The central pane contains a 3-D globe on which your data will be mapped. A floating Field List containing fields in the selected Excel data model initially appears over this 3-D globe. The left Tour Editor pane contains thumbnails of all the tours and their scenes animated for your data model in Power Map (by default, there is just one scene marked Scene 1 when you create your first tour).
Drag fields from the floating Field List to the Location, Height, Category, and Time list boxes in the Layer Pane to build your map.
Drag the geographical fields whose location data are to be represented visually on the globe map and drop them into the Location list box in the Layer Pane. Power Map displays data points for each location field for your animation on the 3-D globe as you drop it into the Location list box. The program associates the selected location field with a geographical type in the drop-down list box to the right of the field name in the Location list box in the Layer pane. You can modify the type by selecting its drop-down button, if necessary. Just keep in mind that each location field needs to have a unique geographical type.
You also add fields from the floating Field List that you want depicted in the animation to the Height, Size, or Value list boxes (depending upon the type of visualization selected) as follows:
Select the type of visualization by clicking its icon under the Data heading in the Layer Pane: Stacked Column (default), Clustered Column, Bubble, Heat Map, or Region.
Power Map now displays data points for your Height, Size, or Value data on the 3-D globe appropriate to the type of visualization selected along with a floating legend for the data values (organized by any fields used as categories) in the center pane of the Power Map window. At the bottom of the map, you see a Time Line control with a play button that enables you to play and control the animation (see Figure 2-20).
(Optional) Click the Close the Layer Pane button and Close the Tour Editor button to hide the display of Layer and Tour Editor panes, respectively.
Now, your 3-D globe with the Layer 1 legend on the right side and animation timeline below fill the entire window below the Power Map Ribbon. Note that you can redisplay the Layer pane and the Tour Editor pane in the Power Map window at anytime by clicking the Layer Pane or Tour Editor Ribbon buttons, respectively.
(Optional) Drag the Layer 1 legend so that it’s not obstructing your 3-D globe. You can also resize the legend by selecting it and then dragging its sizing handles. If the Time Line animation control is obstructing key areas of the globe, you can hide it by clicking its Close button.
You can redisplay the Time Line control at anytime by clicking the Time Line button in the Time group on the Power Map Ribbon. Note that you can’t reposition or resize the Time Line control when it is displayed and that you can play your animation by clicking the Play Tour button on the Ribbon when the Time Line control is hidden.
(Optional) Drag the globe to display the area of the world with the locations you want to watch when you play your animation or use the Rotate Left (Shift+@--left), Rotate Right (Shift+@--right), Tilt Up (Shift+@--up), or Tilt Down (Shift+@--down) buttons to bring this area into view. Then, click the Zoom In (Shift+ +) or Zoom Out (Shift + -) to bring the area closer into view or further away.
Once you have the viewing window beneath the Power Map Ribbon positioned the way you want it when viewing your animation, you are ready to play the 3-D map tour you’ve created.
Click the Play Tour button on the Ribbon or the Play button on the Time Line control (if it’s still visible).
When you click the Play Tour button on the Ribbon, Power Map automatically hides the Tour Editor and Layer pane along with the Time Line control if they are still visible at that time. You can pause the animation by clicking the Pause button that appears in a cluster of controllers in a bar at the bottom of the screen or by pressing the spacebar on your keyboard. When you’re finished watching the animation, return to the regular editing view of Power Map by clicking the Go Back to Edit View button (the one with the arrow pointing left at the very beginning of the bar at the bottom of the screen) or press the Esc key on your keyboard.
After you create your initial animation tour for the data model in your Excel workbook, you can always replay it simply by reopening it in Power Map and clicking Play Tour on its Ribbon. To reopen the tour when the workbook with the data model is open in Excel, select Insert ⇒ Map ⇒ Open Power Map on the Excel Ribbon (Alt+NSMO) and then click the Tour 1 button at the top of the Launch Power Map dialog box.
Once the tour is open in Power Map, you can also edit it. You can change the appearance of the 3-D globe in your animation by selecting a new theme by clicking the Themes button in Scene group of the Power Map Ribbon and then selecting a thumbnail on this button’s drop-down palette. You can flatten 3-D globe to make it two-dimensional by clicking the Flat Map button in the Map group of the Ribbon.
You can also add new layers to your original scene that animate a different data set over the same or a different set of date and time values. To add a new layer, click the Add Layer button in the Layer group of the Power Map Ribbon and then define the type of visualization and the fields to use in your data model for the location, analysis, and time (following the same steps as outlined earlier for creating the initial layer of the first scene of a new tour). After you add a new layer (automatically named Layer 1) to your original scene, Power Map shows the legends for both Layer 1 and 2 (which often overlap and need to be separated manually). Power Map also shows the data points for each layer’s location, analysis, category, and time fields when you play the animation.
If you want to see the animation for just one of the layers in your scene, you hide all the other layers before you play the animation. To do this, click the Layer Manager button at far left on the top of the Layer Pane and then click the Show or Hide Layer button (the one with the CBS eyeball icon) in front of the name of all layers you don’t want to view in the animation.
In addition to adding new layers to a scene, you can also add entirely new scenes to your tour that use a copy of the active scene, a new 3-D globe world, or a custom map with an entirely new background. To create a new scene, click the New Scene button in the Scene group of the Power Map Ribbon and then click Copy Scene, World Map, or New Custom Map options on its drop-down menu. After you select the type of scene, you then define the animation for the new scene using the steps you followed earlier in creating the opening animation for the first layer in the first scene of the tour. To play the animations you add to the layers of any new scene you add to your Power Map tour, you simply click the Scene thumbnail in the Tour Editor pane before you click the Play Tour button on the Ribbon or the Play button on its Time Line controller.
Click the Create Video button to create a video of the animation for the currently selected scene and layer(s) in your tour. When you click this button, Power Map opens a Create Video dialog box where you choose the quality of the video selecting one of the following option buttons: Presentation & HD Displays (largest size and best quality at 1080 pixels), Computers and Tablets (medium size and quality at 720 pixels), or Quick Export & Mobile (lowest quality and smallest size at 320 pixels). If you want an existing music or narration file to accompany the animation, click the Soundtrack Options button and then select the sound file and the playback options followed by Apply before you click the Create button to make the video. Power Map then generates a video of the currently selected animation saved as .mp4 video file in your device’s default Video folder. You can then save this video file to a folder on your OneDrive or Dropbox to share with colleagues or clients. You can also play the video on your device using its default video player.
The new Forecast Sheet feature in Excel 2016 makes it super easy to turn a worksheet containing historical financial data into a remarkable visual forecast worksheet. All you do is open the worksheet with your historical data, position the cell cursor in one of its cells, and then click the Forecast Sheet button on the Data Tab of the Ribbon (Alt+AFC).
Excel then selects all the historical data in the surrounding worksheet table (which typically includes a column for dates as well as one for the related financial data) while at the same time opening the Create Forecast Worksheet dialog box (similar to the one shown in Figure 2-21).
By default, Excel selects a line chart to visually depict the trends in its forecast, but, if you wish, you can have the program use a column chart instead. Simply click the Column Chart icon to the immediate right of the Line Chart icon at the top of the Create Forecast Worksheet dialog box.
In addition to selecting the type of chart to be used in the forecast worksheet, you can also control the date at which the forecast chart ends. You do this by selecting a new date in the Forecast End text box that appears below the preview of the embedded line or column chart. For example, in Figure 2-21, my historical data table includes annual sales for the years 2000 through 2015, and Excel automatically uses this data to extend the forecast end date out four years to 2019. If I wanted to extend the forecast beyond this end date, I would simply enter the new year into the Forecast End text box (or select one with the spinner buttons).
Beneath the Forecast End text box in the Create Forecast Worksheet dialog box, you find an Options button that when clicked (as shown in Figure 2-21) expands the dialog box to include the following options:
After selecting all the desired options in the Create Forecast Worksheet dialog box, you have only to click the Create button to have Excel create a new forecast worksheet. This new sheet contains a formatted data table that combines your historical data with the forecast values as well as an embedded line or column chart (depending upon your selection) depicting the trend in both the historical and forecast values.
Figure 2-22 shows the brand new forecast worksheet that the Excel Forecast Sheet feature created for me using the original historical sales data shown in Figure 2-21 after I selected Set Manually option button with the setting at zero and selected the Include Forecast Statistics check box before clicking Create in the Create Forecast Worksheet dialog box. As you can see, Excel placed this new forecast worksheet (named Sheet1) before the worksheet containing my historical data (named Annual Sales).
Note that in order to display all the forecast values in the new formatted data table in Figure 2-22, I repositioned and resized the embedded line chart so that it fits nicely in the lower-right corner before taking the screenshot. If I wanted, I could move this chart to its own chart sheet before saving the new forecast table and chart as part of the Historical and Forecast Sales workbook.
3.139.233.43