# ピボットテーブル

行/列でデータを集計し、ピボットテーブルとして表示します。

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

## 仕様

### フィールドの役割

ピボットテーブルは、[行・列をディメンション、値をメトリクスとして集計](/data-exploration/chart/chart-common.md#dimension-metric)して、集計結果をテーブル形式で表示します。

| 項目 | 役割      | 補足             |
| -- | ------- | -------------- |
| 行  | ディメンション | 1つ以上           |
| 列  | ディメンション | 任意             |
| 値  | メトリクス   | 数値/文字列メトリクスに対応 |

## Tips

### ドリルダウン

ピボットテーブルでは行を階層的に表示し、折りたたむことができます

設定方法

1. 行フィールドを複数設定
   * チャート設定の「行」に、大カテゴリ・小カテゴリなど2つ以上のフィールドを設定します。
   * 例: 都道府県（大カテゴリ）→ 市区町村（小カテゴリ）
2. ツリー表示に切り替え
   * 「詳細設定」→「レイアウト」→「デフォルトの階層タイプ」で「ツリー」を選択します。
     * グリッド: 従来の表形式
     * ツリー: 階層構造で表示、開閉アイコンで展開・折りたたみ可能
3. 初期状態を折りたたみに設定（オプション）
   * 「折りたたんで表示」にチェックを入れると、初期表示時に全階層が折りたたまれた状態になります。

補足

* 行フィールドが2つ以上の場合のみ設定可能です
* レポート閲覧者は自由に展開・折りたたみできます

### 加工方法による違い

ピボットテーブルでは、[インメモリ処理](/data-exploration/chart/chart-common.md#in-memory-processing)が行われた場合と、クエリによる加工処理が行われた場合で、表示される結果が異なります。

* インメモリ処理の場合
  * 行や列の数に制限がなく、集計されたすべてのデータを表示できます
* クエリによる加工処理の場合
  * 行と列はそれぞれ30個までに制限されます
    * 30個を超える場合、 `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.jp/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.
