Pivot Table Tutorial Using Ontario s Public Sector Salary Disclosure Data Now that have become more familiar with downloading data in Excel format (xlsx) or a text or csv format (txt, csv), it s time to move to the next level: using simple calculations and pivot tables to analyze the data. As we saw in the salary disclosure dataset, there were stories that merely pointed to the fact that the list contains a greater number of people. While such stories are fine, they could be more adventurous in mining the richness of the dataset. The purpose of this tutorial is to pull solid ideas out of the data to pitch at the story meetings, or to editors or producers. So let s get started. 1) Return to the public-sector disclosure 2014 dataset we used for the test. If you don t have it, then download the xlsx file from the Ontario website. As we learned in class, you re looking for the Full compendium [XLSX], not the PDF versions. (NOTE: As you should know by now, XLSX is the extension for Excel.) 2) Open the table, copy table on the original Salaries worksheet into a new worksheet and called it WorkingCopy, or WorkingCopy2 if you re working from the table used for the test. 3) Clean up the column titles by removing the French-language portions. (NOTE: If you re having problems with the column expanding widths that make navigating to the adjacent column virtually impossible, you do one of two things: De-activate the Excel option to auto-sizes the column widths. Its location will vary depending on the version that you re using. If you can t find
it, then try Excel s help menu. The second option is simply highlighting the problematic column, right-clicking to get your short-cut menu, selecting the Column Width option, and reducing the number of characters to 30 or 20.) 4) Since a taxable benefit could be considered part of the employee s salary, we will add that number to the value in the Salary Paid column. 5) Call column I Total_Salary, and use the + operator to add the two values. The textbook covers these basic operators on page 78. (NOTE: remember that you can simply click on the cell references rather than typing them. This way, you avoid mistakes.) 6) Now that you ve plugged in the addition formula, hit enter on your keyboard, which moves the cursor to the cell directly below. Place your cursor on cell I2 to reformat the number as currency with two decimal places, and then copy the formula to the bottom of the column. Be sure to verify that Excel has indeed populated ALL the cells in the column. If, for instance, there is a blank space, Excel will stop, forcing you to manually drag the cursor to the bottom of the column, which is more time-
consuming. 7) Now let s deal with those taxable benefits. You can find the definition on the Public Sector Salary Disclosure website in the introduction section. At first glance, the amount of these benefits vehicles, relocation costs, subsidized housing, etc. may not look like much. But what if we calculated them as a per cent of the total, an exercise we performed in our first tutorial, using Citizenship and Immigration Canada s refugee-claimant dataset? 8) Call column J, Taxable_Benefits_&_Of_Total, and use formula for calculating a percent of the total, which is covered in that first tutorial, and on pages 74 and 75 of our textbook.
9) We will divide the taxable benefit by the total salary. 10) Copy the formula, and make sure that the values are properly formatted as per cents with one decimal point. And make sure it copies all the way to the bottom.
11) The new totals look unimpressive. That is, until your sort them in descending order. 12) Andrea Riekstins salary is one of the lowest ones, but her taxable benefit is a large per cent of her total salary. We are not suggesting there is anything wrong here. Remember, a good dataset is a mere tip sheet that tells us WHAT, not WHY. It s worth asking why her taxable benefit is so high compared to the majority of the employees on the list. 13) Now we are ready to construct a pivot table, which is covered on pages 87-90 of our textbook. 14) Place your cursor inside the table, and go the Insert section of your Ribbon at the top, or Data for Mac users. You want the pivot table option. For Mac users, be sure to select the manual option. The automatic option will randomly populate
your pivot table with values. 15) Pay close attention to the range of cells next to the Select a table or range option. The range should cover the entire table. The dollar sign on each side of the letter anchors the two cell references on either end of the range. (NOTE: the textbook covers anchoring in the TECH TIP on page 75.) 16) We also want to place the pivot table into a new worksheet, which is Excel s default choice.
17) Hit the OK tab. 18) As we suggested in class, a pivot table is one of the most powerful and efficient ways of analyzing data because it summarizes different categories and performs math on their values. In this instance, we may want to know which employer has the greatest number of employees on the list. To calculate this, we can drag the Employee field in to the Row Labels section of the bottom section of the Pivot Table Field List box to the right. Essentially, the Row Labels groups the values that form an important part of the story we want to tell, or fodder for
questions we want to ask. 19) The pivot table has grouped the employees in the table to the left, and may have expanded the column width, making it difficult to manipulate. To account for the automatically expanding column widths, put your cursor inside the table, rightclick to get a short-cut menu. Choose the PivotTable Options, and de-elect the Autofit column widths on update option under the dialog box s Format section. For Mac users the option may
be labelled something slightly different. 20) Now we want SUM the total salaries for all the employees in each group. Drag that total salary field that we created into the Values section to the right, and be sure to reformat the
numbers as currency. 21) Sort the Total column in descending order. 22) Now what if we also wanted to count the number of employees for each employer? We can perform another
calculation on the total salary column, by dragging it into the values section once again, but this time COUNTING the number of employees. We also want to format the values as numbers with no decimal places.
23) Now we have summed the values and counted the number of employees. So Ontario Power Generation paid more than $10 million to more than 76 hundred employees. 24) We could also use the Report Filter to create yet another subset. 25) Let s say that we were only interested in individuals who occupied a certain position. We could drag the Position Title into the Report Filter section. 26) We could then filter the Position Title for all the directors. The Multiple Items highlighted in red in cell B1 in the screen shot below refers to the fact that you have checked off multiple items from the drop-down menu -- in this case all the directors --
just like you did when filtering datasets on the test. 27) We can see the city of Toronto has the highest number of directors. 28) There are many ways to use the pivot table to summarize information. For instance, you could group the employee titles and use the employer as the report filter. 29) Play around with different combinations, such as the city of Ottawa, school boards and hospitals. Doing so will prepare you for the pivot table test.