Tải bản đầy đủ (.pdf) (16 trang)

Pivot Table Limits and Performance

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (311.47 KB, 16 trang )

195
CHAPTER 9
■ ■ ■
Pivot Table Limits and
Performance
E
xcel PivotTable reports can summarize large amounts of data, but there are limits to
what can go into different areas of the pivot table layout. When you’re working with very
large databases, performance can suffer, and creating or refreshing a pivot table can be
extremely slow. This chapter outlines some of the limits and discusses ways to optimize
the PivotTable performance.
9.1. Understanding Limits: 32,500 Unique Items with External
Data Source
Problem
Your pivot table is based on a large external database that contains hundreds of thousands
of records. You tried to add an OrderID field to the row area of your pivot table, and got
the error message “A field in your source data has more unique items than can be used in
a PivotTable report. Microsoft Office Excel may not be able to create the report, or may
create the report without the data from this field.” You’d like to be able to view the OrderID
field in the pivot table.
Solution
If there are more than 32,500 unique items in the field, you won’t be able to add it to the
pivot table’s row, column, or page area. It can go into the data area to be summarized.
When using an external database as the source for a pivot table, you can use one or
more page fields to limit the data that’s retrieved from the source. These page fields are
referred to as server page fields. For example, add the Salesperson field to the page area,
and select a salesperson’s name from the dropdown list. Only their orders will be retrieved
from the external database, and the number of unique OrderIDs should be below the
32,500 unique item limit.
6293ch09.qxd 2/1/06 2:29 PM Page 195


Note
This option is not available for OLAP-based pivot tables.
1. Move one or more fields to the page area of the pivot table.
2. Right-click a page field, and choose Field Settings.
3. Click the Advanced button.
4. Under Page field options, select Query external data source as you select each
page field item (requires less memory).
5. Leave the checkmark in Disable pivoting of this field (recommended).

Tip
This setting will prevent users from accidentally moving the field to another part of the pivot table,
where it could damage the pivot table layout.
6. Click OK to close the PivotTable Field Advanced Options dialog box.
7. Click OK to close the PivotTable Field dialog box.
8. Select an item from the page field dropdown list to see the data for that item in the
pivot table.

Note
The (All) option is removed from the page field’s dropdown list of items. If (All) was selected in the
page field, when Query external data source as you select each page field item is turned on, the first item in
the list will be selected after the query runs. If an item is selected in the page field, it will remain selected
after the option is turned on.
To regain the ability to show all records, you can turn off the Query external data
source as you select each page field item setting:
1. Double-click the page field button.
2. In the PivotTable Field dialog box, click the Advanced button.
3. Under the Page field options, select Retrieve external data for all page field items
(faster performance).
9.1


UNDERSTANDING LIMITS: 32,500 UNIQUE ITEMS WITH EXTERNAL DATA SOURCE196
6293ch09.qxd 2/1/06 2:29 PM Page 196
9.1

UNDERSTANDING LIMITS: 32,500 UNIQUE ITEMS WITH EXTERNAL DATA SOURCE 197
4. Click OK to close the PivotTable Field Advanced Options dialog box,
5. Click OK to close the PivotTable Field dialog box.
How It Works
Using the Query external data source as you select each page field item option creates
server page fields that restrict the amount of data that’s returned from the source database.
When you turn this option on, you can no longer select to see all the data from the field
but can select only one item at a time. For example, for a Region field, only one region can
be selected, and only its records are summarized in the pivot table.
When you select an item from a server page field, Microsoft Query opens and returns
the data for the selected page field item. You’ll see the Microsoft Query button on the
Windows Taskbar, and may see the query progress indicator at the left side of the Excel
Status bar. The pivot cache is cleared and then filled with records for the newly selected
item. The pivot table is refreshed and shows the current records.
When using this option, it’s best to leave on the setting for Disable pivoting of this field,
as recommended in the PivotTable Field Advanced Options dialog box. If the page field were
moved to another part of the pivot table, the Query external data source setting would be
automatically turned off. All the data would be retrieved, and fields with too many unique
items would be removed from the pivot table layout.
Using this option may make the pivot table slower when you select a different item in
the page field dropdown list. Because it has to retrieve the data from the external source,
then display it, it takes longer than changing the item in a normal page field dropdown,
where all the data is already available.
An advantage to using the option is that less memory is used, because all the data
isn’t in the pivot cache. This can make the file size much smaller, even if the data is saved
with the pivot table. Also, by returning the data in smaller segments, you can prevent some

fields from exceeding the unique item limit, which they might otherwise hit if all the data
were returned.

Tip
If you apply this setting to a page field in the PivotTable and PivotChart Wizard, as you create the pivot
table, the initial setup time for the pivot table may be faster.
6293ch09.qxd 2/1/06 2:29 PM Page 197
9.2

UNDERSTANDING LIMITS: 32,500 UNIQUE ITEMS WITH EXCEL DATA SOURCE198
9.2. Understanding Limits: 32,500 Unique Items with Excel
Data Source
Problem
Your pivot table is based on a large Excel list. You tried to add an OrderID field to the row
area of your pivot table, and got the error message “A field in your source data has more
unique items than can be used in a PivotTable report. Microsoft Office Excel may not be
able to create the report, or may create the report without the data from this field.” You
can’t create server page fields, as described in Section 9.1, because the pivot table source
isn’t an external database.
Solution
If there are more than 32,500 unique items in the field, you won’t be able to add it to the
pivot table’s row, column, or page area. It can go into the data area to be summarized.
One option is to name the range that contains the Excel list and create the pivot table
in a different workbook, using the named list as an external data source. Then, use the
server page fields, as described in Section 9.1.
Another option is to use calculations in the source data to split the entries into multi-
ple fields. For example, if there is an eight-digit OrderID number in column A, use LEFT
and RIGHT formulas to create two new fields.
1. Create two new columns in the pivot table source list.
2. Add the headings OrderID_A and OrderID_B.

3. In row 2 of the OrderID_A column, enter the formula
=LEFT(A2,4)
4. In row 2 of the OrderID_B column, enter the formula
=RIGHT(A2,4)
5. Copy the formulas down to the last row of data.
6. Refresh the pivot table, and add the new fields to the row or page area. With four
digits per field, there would be a maximum of 10,000 unique entries in each field,
which is well below the unique item limit.
6293ch09.qxd 2/1/06 2:29 PM Page 198
9.3

UNDERSTANDING LIMITS: ONLY THE FIRST 255 ITEMS DISPLAYED 199
Figure 9-1. Message displayed when column field items exceed 255 items
9.3. Understanding Limits: Only the First 255 Items Displayed
Problem
You tried to add the Sales Date field to the column area of your pivot table, and got a mes-
sage that said the field exceeds 255 items (see Figure 9-1). You want to show the dates in
the column area, not a different area.
Solution
The 255 items mentioned in the error message refers to the number of columns available
to display the items, rather than a pivot table limit. You can add the date field to the col-
umn area, and as many dates as possible will be displayed. Then, leave the field as is, or
group the dates so the full date range is displayed.
1. Click the Continue Drop button to allow the field to be added to the column area.
2. Click OK to the next message that appears: “The PivotTable report will not fit on
the sheet. Do you want to show as much as possible?”
3. As many dates as will fit are displayed in the column area.
4. To group the dates, right-click the Date field button.
5. Choose Group and Show Detail ➤ Group.


Note
If the date field contains blank cells, or cells with text, you won’t be able to group the dates.
6. Choose a time period for grouping. For example, select Days, and set the number
of days to 7 to summarize the data in one-week periods.
7. Click OK to close the Grouping dialog box.
6293ch09.qxd 2/1/06 2:29 PM Page 199
Figure 9-2. Error message when a column has more than 8,000 items
How It Works
Date fields often have too many unique values to display in the column area of the pivot
table. There are only 256 columns on the Excel worksheet, and at least one column is
reserved for the row area, even if there are no row fields currently in the pivot table.
If you add a field to the column area and it has too many items to display, nothing is
lost from the pivot table. In most cases, if you move the field to the row area, you can see
all the items.
9.4. Understanding Limits: 8,000 Items in a Column Field
Problem
You tried to add the Order ID field to the column area of your pivot table. When you
dragged the field onto the column area, the pointer didn’t change to the column area
shape, as it normally does. When you released the mouse button, you got a warning mes-
sage that said the field has more than 8,000 items and can’t be placed in the column area
(see Figure 9-2).
9.4

UNDERSTANDING LIMITS: 8000 ITEMS IN A COLUMN FIELD200
Solution
As the warning message suggests, you could place the field in the row or page area of the
pivot table instead of the column area.

Caution
If the field will cause the row area to exceed its row limit, the placement will fail without

a warning message.
If you place the field in the row area, you may be able to group the items to create
fewer items than the 8,000 limit, and then move the grouped field to the column area.
6293ch09.qxd 2/1/06 2:29 PM Page 200

×