# Pivot Table

Aggregate data by rows/columns and display it as a pivot table.

| <picture><source srcset="/files/dFPgKqweP0m3jROf4w9u" media="(prefers-color-scheme: dark)"><img src="/files/eMgVec50Skla1H5rIdcc" alt="Pivot Table"></picture> |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------- |

## Specifications

### Field Roles

Pivot tables aggregate [rows and columns as dimensions, and values as metrics](/data-exploration/chart/chart-common.md#dimension-metric), then display the results in a table format.

| Item    | Role      | Notes                           |
| ------- | --------- | ------------------------------- |
| Rows    | Dimension | One or more                     |
| Columns | Dimension | Optional                        |
| Values  | Metric    | Supports numeric/string metrics |

## Tips

### Drill Down

Pivot tables can display rows hierarchically and allow collapsing them.

How to Configure

1. Set multiple row fields
   * In chart settings "Rows", set two or more fields such as major category and minor category.
   * Example: Prefecture (major category) → City/Town/Village (minor category)
2. Switch to tree display
   * "Advanced" > "Layout" > "Default hierarchy type" > Select "Tree".
     * Grid: Traditional table format
     * Tree: Display in hierarchical structure, expandable/collapsible with expand/collapse icons
3. Set initial state to collapsed (optional)
   * Check "Start collapsed" to show all hierarchies collapsed in the initial display.

Notes

* This setting is only available when there are two or more row fields
* Report viewers can freely expand and collapse

### Processing Differences

When using pivot tables, the results may differ depending on the data processing method. Pivot tables use [in-memory processing](/data-exploration/chart/chart-common.md#in-memory-processing) and [query processing](/data-exploration/chart/chart-common.md#query-processing).

* In-memory processing
  * No row or column limits, so all data can be displayed
* Query processing
  * Limited to 30 rows and 30 columns
    * If it exceeds 30, rows or columns are grouped into `Others`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.codatum.com/data-exploration/chart/pivot-table.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
