qobrix_aggregate
Compute sum, average, min, max, or count of Qobrix numeric fields across matching records, optionally grouped for top-N buckets.
Instructions
Sum / avg / min / max / count of a numeric field across all matching records — optionally grouped by another field (top-N buckets). Paginates server-side (cap 20,000 rows) and computes in-process, which is how to get totals on Qobrix fields the API won't sort. Example uses: Total 2026 closed-sale volume: resource='contracts', field='final_selling_price_amount', op='sum', search='contract_type == "cos" and contract_status == "agreed" and date_of_contract >= "2026-01-01" and date_of_contract < "2027-01-01"'. Agent leaderboard by volume: same search, group_by='commission_to_2', top=5. Average list price by property type: resource='properties', field='list_selling_price_amount', op='avg', group_by='property_type', search='status == "available"'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | Yes | Aggregation: 'sum' total, 'avg' mean, 'min'/'max' extremes, 'count' rows with a non-empty value. | |
| top | No | When group_by is set, number of top buckets to return (default 10, max 50). Buckets sorted by op desc. | |
| field | Yes | Numeric field to aggregate (e.g. 'final_selling_price_amount', 'commission_value_amount', 'list_selling_price_amount'). For op='count', any field works (only non-null values are counted). | |
| search | No | Hard-filter Qobrix search expression (server-side precision). Operators: == != <> < > <= >=, contains, starts with, ends with, in [...], not in, ranges in a..b, and/or/not. Functions: DISTANCE_FROM, IN_POLYGON, TRANSLATED, MIN/MAX, DAYS_AGO(n), MONTHS_AGO(n), DAYS_FROM_NOW(n). Shortcuts: NOW, TODAY, THIS_WEEK, LAST_MONTH, THIS_YEAR, CURRENT_USER. Strings double-quoted; booleans true/false; association paths e.g. SalespersonUsers.Contacts.country. Example: status == "available" and sale_rent == "for_sale" and list_selling_price_amount <= 500000. For the full grammar + field cheatsheets call qobrix_search_dsl_help. For enum values call qobrix_get_field_options; for all fields call qobrix_get_schema. | |
| resolve | No | If true and group_by looks like a UUID FK (or any dim of a multi-dim group_by does), resolve bucket keys to readable names. Defaults to true when any dim is in the always-resolve set, false otherwise. | |
| group_by | No | Optional grouping. Pass a single field name (e.g. 'commission_to_2' for agent leaderboard, 'property_type' for type-mix, 'city' for geo) or an array of 2-3 fields for a multi-dimensional pivot (e.g. ['city','property_type']). Without group_by returns a single aggregate. | |
| resource | Yes | Resource name (case-sensitive, lowercase plural as used by Qobrix API). Values: properties, opportunities, contacts, agents, tasks, property-viewings, projects, offers, contracts, calls, meetings, email-messages. |