The Database

From Apache OpenOffice Wiki
Jump to: navigation, search



The Database

The first thing we need to have on hand for a Pivot Table is a set of raw data, similar to a database table. Such a set should comprise rows (AKA records) and columns (AKA fields). Moreover, field names must be in the first row of any such list.

Almost anything can serve as a data source – for instance, one can use an external file. In many cases, it is most convenient to use the raw data in the file that will contain the Pivot Table. For processing lists of data, Calc and its Pivot Tables need to know where the list is in the spreadsheet. That can be anywhere in the sheet, in any position; a spreadsheet can even contain several unrelated lists.

Calc recognizes your lists automatically. It uses the following logic:

  • You must begin your effort by selecting a cell that is within the range of the items in your list.
  • Starting from that cell, Calc checks the surrounding cells in all four directions (left, right, above, below). A border is recognized if the program discovers an empty row or column or if it hits the spreadsheet's first or last row or column.
  • This means that the Pivot Table's functions can only work correctly if there are no empty rows or columns in your list. Avoid these; if you want to distinguish regions of the data, format your list by using cell formats.
Documentation caution.png Again, be careful - no empty rows or empty columns are allowed within lists.

If you select more than one single cell before creating the Pivot Table, the automatic list recognition is disabled. Calc assumes that the list exactly matches the cells you have selected.

Documentation caution.png When using the Pivot Table, always select only one cell or carefully select the entire data set. Failing to do so may result in empty rows or columns.

In addition to these formal aspects, logical structure is very important when using Pivot Tables. When entering data, don't add outlines, groups, or summaries. Here are some mistakes commonly made by inexperienced spreadsheet users:

  1. You made several sheets, for example, a sheet for each group of articles. Analyses are then possible only within each group. Analyses for several groups would be a lot of work.
  2. In the Sales list, instead of only one column for the amount, you created a column for each employee's amounts. The amounts had to be entered manually into the appropriate column, making an analysis with a Pivot Table impossible. In contrast, one benefit of a Pivot Table is that you can get results for each employee if you've entered data with the appropriate layout.
  3. You entered the amounts in chronological order. At the end of each month you made a sum total. In this case, processing the list for different criteria is not possible because the Pivot Table will treat the sum totals the same as any other figure. Getting monthly results is one of the very fast and easy features of Pivot Tables.
Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools