PivotTables: A comprehensive guide (part 2 of 2)

In the last post, we covered the fundamental principles that supported PivotTables, and reached the stage at which the frame of the PivotTable was built.

This post will introduce you to the analysis itself.

So now, we have the wireframe of a PivotTable.

The frame of a PivotTable

There are four sections within a PivotTable. Each can house one or more fields. And to get the fields into those sections, you either drag them into the four boxes directly below the field list; or you drag them into the table itself. Each way yields the same result.

Page fields (or Report filters)

These are filters that are applied at the field level. You use this feature if you want your PivotTable to only look at a subset of rows in your source data: a specific geography; women; high-priority risks. You can drag multiple fields into this area, allowing you to, say, only analyse males in the US.

Column fields/labels

These will contain the fields whose values you want to see in the columns. If you want each column to show a different country, drag the "country" field into this section. And if you want to see cities within each country, then drag both fields into that section. The top-most field will form the first grouping, and so on.

Once selected, a dropdown box will appear next to the column title in the table itself. This can be used to sub-select those values that you want to appear. You may, for example, not want to report data for the US.

Row fields/labels

These will contain the fields whose values you want to see in the rows. If you want each row to show a different gender, drag the "gender" field into this section. And if you want to also group your data by age, drag both fields into that section. Again, the top-most field will form the first grouping, and so on.

As with the columns, a dropdown box will appear next to the row title in the table, which can be used to sub-select those values that you want to appear.

Data/values

Here's the bit that quite a few people find a bit odd: the data itself. It's also the crux of the puzzle.

If you've defined your filters and row and column headings, the frame of your table looks good, but without populating data/values. So here's how they work.

If you simply want to count records, then choose any field that's populated across all records (a unique reference number or gender, for example). If it's a text field, then the PivotTable will have no option but to count. (Have you ever tried to sum a bunch of countries?)

Intuitively (to me at least), it would make more sense if PivotTables defaulted to give a count of the records. But in the absence of this, you're forced to choose a field, then contents of which are counted. Note: it only counts rows that contain something in the column selected. So if you want to count every row, choose something that's populated exhaustively. So if you have a record with a missing gender and choose gender as your data/values field, that record will not be counted.

If instead you choose a field that's formatted as a numeric, then Excel will decide that you're probably looking to sum the data. So, for example, if you drag the Revenue column into the core of the table, it will show the total (sum of) revenue by geography (if geography is in the column labels).

PivotTables with sums

If you want to report on multiple fields, the core of the table can accommodate multiple fields. You may, for example, want to report both revenue and profit for each intersection of rows and columns.

If sums are not sufficient for you, then hit the down arrow next to the field name in the tray in which it appears below the PivotTables field list. Hit Value Field Settings. A list of other functions appears for selection on the Summarize by tab, the most useful being Max, Min and Average.

That same dialog box contains additional options on the Show values as tab. The dropdown at the top allows you to change the way in which your data appears. So instead of showing values you can, for example, show the percentage of the row or column that the value represents. It's worth having a play in this area once you're confident in the more common functionality.

If you have any questions, please get in touch. PivotTables are quite daunting, but once you become comfortable using them, they unleash such power.

This entry was posted in How to and tagged . Bookmark the permalink.

2 Responses to PivotTables: A comprehensive guide (part 2 of 2)

  1. Peter Jones says:

    Dan. Like you I have used Excel for 20+ years having started on VisiCalc then Lotus 123). I still use it a lot in my day job and have a question on Pivot tables.
    If I have two tables where the Report Filters are the same, is it possible to link them so that I only have to edit on one table. I.e make the filters on table two a slave to the filters on table one?
    There us a legitimate reason why there are two tables and not one in the first place.

    • Dan says:

      Hi Peter,

      As far as I know, no. I'm wondering whether you can create a dropdown field outside of the realms of the PivotTable that itself drove an "in scope" column in your source data. So if you have values of Product A, B or C, then you could have a 1/0 field in the source data that calls on that dropdown. (If Product A is chosen then populate with a 1 for all Product A rows and a zero for all Product B/C rows.)

      Then you put a report filter on both tables to only show items where "in scope" = 1.

      Changing the dropdown would not immediately refresh the PivotTables because of the change in underlying data. But you could have a "Refresh Now" button to allow you to do this.

      Admittedly, this only works for single-selects.

      Hope it helps.

      Dan.

Comments are closed.