> For the complete documentation index, see [llms.txt](https://docs.powertable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.powertable.com/explore-powertable/working-with-powertable/explore-data/group-rows-by.md).

# Group Rows By

The **Group By** feature allows users to organize and group rows based on a shared attribute, such as category, status, or date.

Grouping rows improves readability and simplifies navigation, especially in larger datasets. You can easily collapse and expand individual groups or the entire outline, giving you control over the level of detail you want to see.

1. To group rows based on an attribute, click on **Group By.**

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2FC0FcKKGV1BBpnjc4wOOy%2Fimage.png?alt=media&amp;token=86e50778-2d04-449f-9bb7-faf316fffd7d" alt=""><figcaption><p>Click on 'Group By'</p></figcaption></figure>

2. Choose the column by which the records should be grouped. In the example below, we are grouping rows based on product subcategory.

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2FwXhgdldxuaQHptuEwaFA%2Fimage.png?alt=media&amp;token=7370f9df-fdaf-4d4c-927e-df3911ffdc14" alt=""><figcaption><p>Group by product sub-category</p></figcaption></figure>

3. To view the list of items within a group, click on the symbol '>', next to the required group name. The expanded list is shown below:

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2FSZ4ZG0YiFicb3K6Xv0bn%2Fimage.png?alt=media&amp;token=10cf9bda-29d3-41e0-a275-3ba84b553a4e" alt=""><figcaption><p>Expanded group</p></figcaption></figure>

4. Within a group, you can create as many sub-groups as possible. Click on **Add Sub Group** to create a subgroup.

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2FHZ2XpCoJ6gLH78sJJWy4%2Fimage.png?alt=media&amp;token=9f88c363-b3c7-4942-9818-0daf888c6eec" alt=""><figcaption><p>Add Subgroup</p></figcaption></figure>

5. Choose another column to group them inside the primary group. We will select 'Model Name'.

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2FY9gGMwinpePvaNEGKpzB%2Fimage.png?alt=media&amp;token=ce6c5838-2206-4a54-a0c9-df42b3f6e28d" alt=""><figcaption><p>Grouping by another column within a group</p></figcaption></figure>

The results are as below:

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2FB1bs6nzCO1tWp25QKeMx%2Fimage.png?alt=media&amp;token=9f481fbb-b181-4ed4-8837-0c889052ee2d" alt=""><figcaption><p>Groups and sub-groups</p></figcaption></figure>

6. You can use the bin icon to ungroup a particular group. To return to the table, ungroup all of them by clicking the bin icon on all groups.

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2FlrvWQTeOZGaCYWm5VVYs%2Fimage.png?alt=media&amp;token=55b7c170-392a-4810-8eaf-c2216e9a72e1" alt=""><figcaption><p>Ungrouping a group</p></figcaption></figure>

#### Note:

1. Click on the arrows before the group/sub-group names to expand or collapse them.

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2FgtbuAcpv54yzkL2GJfIY%2Fimage.png?alt=media&amp;token=b78d1e71-9fc6-4ec8-8aa7-9b14920b5be0" alt=""><figcaption><p>Expand/collapse groups and sub-groups</p></figcaption></figure>

2. You can edit the table and perform actions like formatting, bulk-editing, inserting rows, using find and replace, sorting, etc. on grouped rows also.

<figure><img src="https://1781349671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKyXRCFh0c08ryiUFvyMV%2Fuploads%2Fcr7Vz7zzRrU8h605QeET%2Fimage.png?alt=media&amp;token=1709648b-d68b-4fb6-8506-e27aadc60902" alt=""><figcaption><p>editing, formatting and inserting rows in a grouped table</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.powertable.com/explore-powertable/working-with-powertable/explore-data/group-rows-by.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
