# Pivoting and Row Grouping

## Properties Menu - Row Grouping and Pivoting <a href="#properties-menu---row-grouping-and-pivoting" id="properties-menu---row-grouping-and-pivoting"></a>

The grid chart includes grouping and pivoting drop zones, allowing users to easily drag and drop attributes into these zones. Below is a screenshot showcasing the drop zones for reference.

<figure><img src="/files/kZevpHaC5dP5da7nPlat" alt=""><figcaption></figcaption></figure>

Here, Region attribute is dragged into pivoting zone and the product category and product sub-category columns will be grouped automatically. Below is the screenshot shown.

<figure><img src="/files/Lte7HuS0hmMVsgauD1Wl" alt=""><figcaption></figcaption></figure>

You can hide the Grouping/ Pivoting drop zones also from the property editor.

<figure><img src="/files/1OxbvmlkNWnvzFH9h1m3" alt=""><figcaption></figcaption></figure>

## **Grouping**

You can define a group by selecting an attribute or metric. Go to the hamburger button of any attribute, expand ‘Grouping’ and select ‘Group by’ an attribute. For Grouping, you need atleast one attribute and one metric in the grid chart.

<figure><img src="/files/IyKVwqxfsoYbbguIwlFx" alt=""><figcaption></figcaption></figure>

In the below screenshot, the grouping is applied on the ‘Year’ attribute level. Vitara grid chart will show the number of sub-elements in each group in round brackets or parenthesis. For example, the group ‘2014’ has 24 sub-elements in it. Click on expand symbol to expand each group.

<figure><img src="/files/TyIuWVs1bzj0Yj8ladyk" alt=""><figcaption></figcaption></figure>

In the Vitara Grid chart, the state of the expand/collapse of a particular group will be saved. when we reopen the dossier/document the groups which are saved in an expanded state or collapsed state will retain its state.

We can group by the “Metrics” column, which is formed from the Metric Pivoting. For Example, In a grid chart apply move to rows for the ‘Profit’ column and Group the “Metrics’ column.

<figure><img src="/files/T0kDxspAQEfeLDcsjGKa" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/7tQgGpbXX04I6JCE5JNg" alt=""><figcaption></figcaption></figure>

There is an example, where ‘Metrics’ column is grouped with the other attributes like Category, Year and Quater. See the screenshot below.

<figure><img src="/files/n5M1DRy3vfYHZlF5XXZj" alt=""><figcaption></figcaption></figure>

## **Pivoting**

Pivoting is the ability to swap the rows to columns and columns to rows in the Grid chart. Pivoting can be done on attributes and as well as on metrics. Which means we can place the attributes in columns and metrics in rows. To pivot a column we can drag and drop an attribute to Pivot drop zone or we can move attribute to columns. Grouped attributes cannot be pivoted.

## **Attribute Pivoting**

Click on the hamburger of any attribute, then click on the **Move to Columns** option. Below are the screenshots of pivoted attributes.

<figure><img src="/files/D8O45kfWFVqj3sT8V84q" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/xBJbCqejyPjZJEevZJ01" alt=""><figcaption></figcaption></figure>

## **Metric Pivoting**

Click on the hamburger of any metric, then click on the **Move to Rows** option. You can see the ‘Metrics’ and ‘Values’ column in the Vitara Grid chart. Below are the screenshots of pivoted metrics.

<figure><img src="/files/XEOtToML9Rc4gWU2G12H" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ntZJGoEITlD8viby5yW8" alt=""><figcaption></figcaption></figure>

We can pivot the “Metrics” column by dragging the “Metrics” column to the pivot dropzone, which is formed by the option ‘Move to rows’ applied to any Metric column in the Vitara grid chart.

For Example, apply ‘Move to rows’ property to profit metric, then drag the “Metrics” column to the pivot drop zone, you can see the attributes in the Vitara grid chart will be grouped automatically. See the below picture where the Category and Year are in the Group by drop zone and “Metric’ column in the Pivot drop zone.

<figure><img src="/files/kD3qftG4uGgMpjIdpFTj" alt=""><figcaption></figcaption></figure>

## **Pivot Totals**

Pivot columns will now collapse and show the ‘Pivot Totals’ in the Vitara Grid chart. Now you need to have at least two attributes and one metric to attain the pivot totals.

First, apply ‘Move to rows’ property on any metric, and drag the ‘Metrics’ columns to the pivot drop zone, as a result you can see the attributes are grouped.Then, to see the pivot totals drag any one of the attribute’s to pivot drop zone and make sure that the ‘Metrics’ column position should be before the Attribute column position in the pivot drop zone. Below are the screenshots of Pivot totals.

<figure><img src="/files/BAIdCkK8Nfw1IKblUvOC" alt=""><figcaption></figcaption></figure>

For Example, apply ‘Move to rows’ property to Cost metric, then drag the Metrics column to the pivot drop zone, and the attributes Category, Sub-Category, Quarter and Year are grouped, and drag the Year attribute to the pivot drop zone next to the ‘Metrics’ column, here you can see the Year wise Pivot totals in the Vitara Grid chart.

<figure><img src="/files/jp6jaY91xyMtBBVRvuOR" alt=""><figcaption></figcaption></figure>

**Enhancement**: Column Totals option will only be used to display total columns in non-pivoted charts. Pivoted charts now include three additional total display options — **Pivot Row** Totals, **Pivot Group** Totals, and **Pivot Group Metric** Totals — providing greater flexibility in data summarization. [Click here](https://tsdocs.vitaracharts.com/grid-chart-guide/subtotals#introducing-pivot-row-total-and-pivot-group-total-for-advanced-subtotaling) for more information.


---

# 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://tsdocs.vitaracharts.com/grid-chart-guide/pivoting-and-row-grouping.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.
