Group by and aggregate
group_byAggregate CSV rows by one or more columns and calculate counts, sums, means, min, max, median, or distinct counts. Filter, sort, and limit results for grouped insights.
Instructions
GROUP BY one or more columns with aggregations (count, sum, mean, min, max, median, count_distinct). Sorted by the first metric descending unless 'sort' is given.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | Yes | ||
| file | Yes | CSV path relative to the allowed directory (CSV_INSIGHTS_DIR), e.g. 'sales/2026-q3.csv' | |
| sort | No | ||
| limit | No | ||
| where | No | Row filters, all must match (AND) | |
| metrics | Yes |