Reporting Aggregation

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 by
  • Aggregates an object of the form:
    • field: [list of aggregates]
    • Valid aggregates are:
      • Sum - sums a numeric field
      • Max - returns the maximum value
      • Min returns the minimum value
      • Count - 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 the WorkTime is requested, the returned field will be SumWorkTime

[!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 the QueueId and AgentId in the GroupFields queries