fbpx

AVG (Average)

< Back

AVG (Average)

Syntax

The AVG function can be used on any fields supporting aggregation which have a numeric type:

  • TimeSpan
  • DateTime
  • Integer (Int32/Int64)
  • Double
  • Float
  • Decimal

It will return the average value across all the values in the query (or the set of values being evaluated for the current Facet or Group).

Examples

This example would return the average number of steps for each script in a project.

AVG(ScriptStepCount) WHERE EntityType = Script

This would return the average time taken to execute scripts within a project (which have an actual duration recorded).

AVG(ActualDuration) AS "Actual", AVG(EstimatedDuration) AS "Estimated"
WHERE EntityType = Script AND ActualDuration IS NOT Empty

This would return the average number of incidents raised per test script assignment, grouped by the type of the associated script.

GROUP BY ScriptType { AVG(IncidentCount) AS 'Average' } AS 'Types'
WHERE EntityType = ScriptAssignment