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.
GroupFieldsan array containing the fields to group byAggregatesan object of the form:field: [list of aggregates]- Valid aggregates are:
Sum- sums a numeric fieldMax- returns the maximum valueMinreturns the minimum valueCount- returns a count of non-null values
DateFilterFieldwhen 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,RelativePeriodEndindicates the relative period range. See [[Relative Date Formats]]RelativeTimezoneindicates 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 theWorkTimeis 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 theQueueIdandAgentIdin theGroupFieldsqueries