Your users ask for a total, an average or a count, over the whole table or per group, and the grid shows it in its aggregation row.
Revenue by category
group categorytotal revenue: sumHow many employees are there per department? Show the number of employees.
group departmenttotal id: sizeSeveral functions at once, one per column:
Group by category and show sum of revenue, average profit, minimum discount, maximum unitPrice, and number of orders on orderId
group categorytotal revenue: sumtotal profit: avgtotal discount: mintotal unitPrice: maxtotal orderId: size| Function | The user says | Works on |
|---|---|---|
sum | total, sum | Numbers |
avg | average, mean | Numbers |
min | minimum | Numbers and dates |
max | maximum | Numbers and dates |
size | count, how many, number of | Any column: it counts rows |
A count appears in the column it is put on: the id column, unless the user names another. To show it under a friendlier heading, set the column's headerName. A total over the whole table ("what is the average salary?") has no grouping. To order groups by their totals, Gridsay also sorts by the aggregated column.
| Setting | Where | With MUI's stock resolver | With the Gridsay helper |
|---|---|---|---|
disableAggregation | Grid prop | Not sent. Gridsay answers with totals, the grid does not show them, and the panel still reports success. | Sent. A question that needs a total is declined. |
aggregable: false | Column | Not sent. The grid totals that column anyway: MUI allows it from code. | Sent. A total on that column is declined. |
availableAggregationFunctions | Column | Not sent. A function the column does not offer shows nothing, and the panel still reports success. | Sent. A function the column does not offer is declined. |
aggregationRowsScope | Grid prop | Totals count the filtered rows unless you set it to all. | The same. |
getAggregationPosition | Grid prop | Where totals show (footer, group rows) is yours to set; an answer cannot move them. | The same. |
Only the five functions exist. Medians, distinct counts and shares of a total are declined:
Show the median salary
I can't compute medians; try the average salary instead.
Your user reads this sentence. The table stays as it was.A custom aggregation function you registered on the grid cannot be asked for either. A condition on a total ("departments with more than 10 people") is declined: see Filtering.
With the helper and disableAggregation on:
Show total salary over the whole table
I can't total salaries here; aggregation is turned off for this grid.
Your user reads this sentence. The table stays as it was.If an answer still totals after one correction, the sentence is "Totals are switched off for this table.", The `salary` column can't be totalled. or The `salary` column doesn't support that calculation.