Example 6: Group — GroupBy with Aggregations
A GroupBy carrying one or more AggregateBy entries, passed to Group<T>.
Payload
{
"fields": ["Category.Name"],
"aggregateBy": [
{ "field": null, "alias": "TotalCount", "aggregator": "Count" },
{ "field": "Price", "alias": "AvgPrice", "aggregator": "Average" },
{ "field": "Price", "alias": "MaxPrice", "aggregator": "Maximum" }
]
}Every group field must end on a simple type, so the key is Category.Name rather than Category: grouping by the navigation itself throws GroupByFieldCannotBeComplexType. Each row names the key by the path with its dots removed — here CategoryName.
Related
- Group extension
- Aggregator enum
- GroupBy validation rules
- Summary example — same shape inside a full where → group → having pipeline.