Shape · Summarize and reshape
Aggregate
Collapses rows into one row per group and works out values for each: sum, count, average, median, mode, percentiles, longest text and more, cash-flow values such as NPV or IRR, and for a geometry the dissolved shape, extent or centroid. With no group, you get one grand-total row.
Also known as: Summarize, group by
How it works
Pick the Group by columns, or leave them empty for one row over the whole table. Under Aggregations, click Add aggregation, pick one or more fields, then the operation. The operation menu lists what the chosen fields' types can take; the rest are shown last, disabled. One operation over several fields gives one column per field, named like sum_amount unless you rename it under Output columns; with one field, type the alias. The operations are Sum, Count, Average, Min, Max, Median, Std dev (sample standard deviation), Count distinct, First, Last, Concatenate, Mode (ties give the smallest value), Percentile (set the percent; interpolated, named like p25_amount) and, for text, Shortest and Longest. A number field also offers the cash-flow operations NPV, XNPV, IRR, XIRR, MIRR, MXIRR and FVSCHEDULE, with their Rate, Period or Date and other settings on the row; an IRR that does not converge warns per group. A geometry field offers Union (dissolve), Extent, Centroid, Convex hull and Collect, so shapes and totals come out of one group-by. Count offers All rows as its field; every other operation needs one. Concatenate joins the values with the Separator, , by default; First and Last take an Order by column and otherwise use the order rows arrive. A blank alias becomes sum_amount or count, and an alias already used gets a _2. The output is sorted by the group columns with nulls first.
Inputs and outputs
Inputs
data— Table
Outputs
data— Table
Settings
The Attributes panel of Aggregate, as in the app: the controls work, but nothing runs — there is no data behind it.
The same settings, as the Assistant writes them
{
groupBy: string[]
aggregations: [{ column: string, func: "SUM"|"COUNT"|"AVG"|"MIN"|"MAX"|"COUNT_DISTINCT"|"MEDIAN"|"STDDEV"|"FIRST"|"LAST"|"STRING_AGG"|"MODE"|"PERCENTILE"|"SHORTEST"|"LONGEST"|"UNION"|"EXTENT"|"CENTROID"|"CONVEX_HULL"|"COLLECT" (the last five on a GEOMETRY column), alias: string, separator?: string (STRING_AGG), orderColumn?: string (FIRST/LAST), percentile?: number 0-100 (PERCENTILE, default 50) }]
}for a total row count: groupBy: [], aggregations: [{ column: "", func: "COUNT", alias: "row_count" }]
Example
You want one line per region with its revenue, order count and number of distinct customers. Group by region and add Sum of amount as revenue, Count of All rows as orders and Count distinct of customer_id as customers. Add Union (dissolve) of geom to the same node and each region also gets its outline, ready for the Map tab.
| region | revenue | orders | customers |
|---|---|---|---|
| North | 1250.00 | 14 | 9 |
| South | 980.50 | 11 | 11 |