Sum

Syntax

The SUM 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 total value across all the values in the query (or the set of values being evaluated for the current Facet or Group).

The SUM function, like the AVG, MIN and MAX functions, takes a single argument, which is the name of the field it should calculate over.

Examples

The follow query returns the total estimated duration of all the scripts within 'Package X' or any of it's child packages:

SUM(EstimatedDuration) WHERE AllPackages = 'Package X' AND EntityType = Script

This example demonstrates a query similar to that used to generate the execution status graph displayed above the execution grid:

SUM(InProgress) AS 'In Progress',
SUM(Undetermined) AS 'Undetermined',
SUM(Errors) AS 'Errors',
SUM(Failed) AS 'Failed',
SUM(NotRun) AS 'Not Run',
SUM(Passed) AS 'Passed',
SUM(Skipped) AS 'Skipped',
SUM(Warnings) AS 'Warnings',
SUM(Blocked) AS 'Blocked'
WHERE EntityType IN [Script,Test]
  • No labels