Group, pivot and unpivot data
Group & Pivot summarises rows by one or more columns, like a spreadsheet pivot table. Open it from the Describe your transformation box (or a + button in the Pipeline panel) › Reshape, Group & Pivot. It is a pipeline task that runs again every time the pipeline refreshes. To turn wide columns into rows, use Unpivot from the same category.
Group and pivot step by step

Step 1 of 6: Open Group & Pivot
What Rows, Columns and Values do
| Field | What it does |
|---|---|
| Rows | The columns you group by. Each unique combination of their values becomes one row. |
| Columns | A column whose unique values become separate column headers. This makes pivot output. Leave it empty for a plain grouped summary. |
| Values | The columns to calculate for each group |
What you can calculate in Values
| Column in Values | What it calculates |
|---|---|
| Number | Pick an aggregation from the menu under the value: Sum, Average, Min, Max or Standard Deviation |
| Text | Joins the group's values into one list, separated by a comma by default. Only while Columns is empty. |
| Same number column twice | Add it again for a second aggregation, for example Sum and Average side by side |
| + Count | A row count for each group. You can add it once. Shown while no column is ticked. |
| + Distinct count | The number of distinct values of a text or ID column in each group. Only while Columns is empty ("Available when "Columns" section is empty"). |
Date columns can go in Rows or Columns, but not in Values. While a text value or a distinct count is in Values, the Columns field is turned off.
Build a pivot table with values as column headers
Add a column to Columns. Each of its unique values becomes a column header, with the Values calculation under it.
Example: put product_name in Rows, promotion_code in Columns and quantity_sold in Values with Sum. You get one row per product and one column per promotion code.
Join text values into one list per group
Add a text column to Values. Each group gets one cell with the group's values joined together.
Example: group orders by customer_id and drop product_name into Values. Set Delimiter to ; and Display Name to products_bought. Each customer gets one row with a list such as "Mug; Teapot; Kettle".
Rename a result column, set its number format or delimiter
Each chip in Values has an edit icon. Click it to open the Edit menu, change the settings and click Save changes.
| Option | Shown for | What it does |
|---|---|---|
| Display Name | Every value, while the result stays in this View | Names the result column. The default reads like "SUM of quantity_sold". |
| Edit format | Number values and counts | Sets the number format: separators, decimal places, currency symbol or percentage |
| Delimiter | Text values | The characters placed between joined values. The default is a comma. |
Number columns in Rows have the same edit icon, with Display Name and Edit format.
For running totals and ranks that keep every row, see Calculate with formulas. Dates in Rows or Columns can be grouped by year, month, weekday or hour: see Group dates by month, year or weekday.
Troubleshooting Group & Pivot
| Symptom | Cause | Fix |
|---|---|---|
| "Adding or averaging it adds up the codes. Did you mean Count distinct?" | Sum or Average on a column marked as an ID | Click Swap to Count distinct, or Keep to leave it |
| "Adding percentages rarely means anything. Did you mean Average?" | Sum on a Percentage column | Click Swap to Average, or Keep to leave it |
| The Columns field is turned off | A text value or a distinct count is in Values | Remove it to pivot |
| A ticked column doesn't arrive in Values | Dates never go in Values; text only goes in while Columns is empty | Use + Count, extract a number from the date first, or empty Columns |
| Sum or Average isn't offered | The column is text, not Number | Add a Convert Column Type step before Group & Pivot. See Convert text to dates and numbers. |
| An empty group appears | The grouping column has empty values | Filter those rows out first, or handle the group later |
The column meaning warnings appear under Values and never block Apply. Once you click Keep, the warning stays dismissed for that step. See Column types, IDs, currency and percentages for how a column gets its meaning.
Related
- Turn columns into rows with Unpivot: the reverse of a pivot.
- Join two datasets on a shared column: summarise a dataset before joining it.
- Group dates by month, year or weekday: the date Edit format list.
- Work with dates and financial years: extract a month or financial year to group by.
Something wrong? support@mammoth.io



