Skip to content
Learn › Clean and shape data: open the docs menu

Group, pivot and unpivot data

All plans · Project Editor or Project Admin · Updated 8 Nov 2026

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

Describe your transformation menu on Reshape, Group & Pivot, with Group & Pivot first

Step 1 of 6: Open Group & Pivot

What Rows, Columns and Values do

FieldWhat it does
RowsThe columns you group by. Each unique combination of their values becomes one row.
ColumnsA column whose unique values become separate column headers. This makes pivot output. Leave it empty for a plain grouped summary.
ValuesThe columns to calculate for each group

What you can calculate in Values

Column in ValuesWhat it calculates
NumberPick an aggregation from the menu under the value: Sum, Average, Min, Max or Standard Deviation
TextJoins the group's values into one list, separated by a comma by default. Only while Columns is empty.
Same number column twiceAdd it again for a second aggregation, for example Sum and Average side by side
+ CountA row count for each group. You can add it once. Shown while no column is ticked.
+ Distinct countThe 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.

OptionShown forWhat it does
Display NameEvery value, while the result stays in this ViewNames the result column. The default reads like "SUM of quantity_sold".
Edit formatNumber values and countsSets the number format: separators, decimal places, currency symbol or percentage
DelimiterText valuesThe 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

SymptomCauseFix
"Adding or averaging it adds up the codes. Did you mean Count distinct?"Sum or Average on a column marked as an IDClick Swap to Count distinct, or Keep to leave it
"Adding percentages rarely means anything. Did you mean Average?"Sum on a Percentage columnClick Swap to Average, or Keep to leave it
The Columns field is turned offA text value or a distinct count is in ValuesRemove it to pivot
A ticked column doesn't arrive in ValuesDates never go in Values; text only goes in while Columns is emptyUse + Count, extract a number from the date first, or empty Columns
Sum or Average isn't offeredThe column is text, not NumberAdd a Convert Column Type step before Group & Pivot. See Convert text to dates and numbers.
An empty group appearsThe grouping column has empty valuesFilter 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.

Was this page helpful?

Something wrong? support@mammoth.io