Aggregate query general form:
{
"GroupFields": ["QueueId", "AgentId" ],
"Aggregates": {
"HoldTime": [ "Sum", "Count"]
},
"StartDateTime": "",
"EndDateTime": "",
"RelativePeriodStart": 0,
"RelativePeriodEnd": 0,
"RelativeTimezone": "America/New_York",
"Resolution": "Day",
"Filter": {}
}
The purpose of the aggregate queries is to summarize the values in a collection. In sql
this would be similar to aggregate functions Count()
, Max()
and Min()
with a Group By
clause.
GroupFields
an array containing the fields to group byAggregates
an object of the form:field
: [list of aggregates]- Valid aggregates are:
Sum
- sums a numeric fieldMax
- returns the maximum valueMin
returns the minimum valueCount
- returns a count of non-null values
DateFilterField
when included in the query specifies which field the date range should apply to.StartDateTime
,EndDateTime
- ISO date format indicating time. Seee [[Constant Date Formats]]RelativePeriodStart
,RelativePeriodEnd
indicates the relative period range. See [[Relative Date Formats]]RelativeTimezone
indicates which timezone for the relaive periods.Resolution
- The resolution used for relative periods.
[!NOTE] Returned Aggregates
When returning the aggregate fields, the field name will be prefixed with the aggregate.
For example, if the sum of theWorkTime
is requested, the returned field will beSumWorkTime
[!NOTE] Cross Tabulation
Using multiple group fields makes it easy to do cross tabulation by multiple fields. For example reviewing agent performance by queues could be done by adding theQueueId
andAgentId
in theGroupFields
queries