averageif()

The averageif() function returns the average value across all instances of a specified template. The instances must be descendants (e.g., children, grandchildren, etc.) or associations of the current work item to be included in the aggregation.

Syntax

averageif(template API name, value, condition)

Argument Description
template API name / association name

(required)

The template API name OR and association of the template instances containing the value to be included in the average.
value

(required)

The value to be averaged.

The value arguments can be constants (i.e., hard-coded values or attribute references) and/or references to metrics. The value argument can also be a mathematical equation.

condition

(optional)

The filter that determines which values to be included in the comparison.

Notes

  • The filter can include “and” and “or” to further clarify the result set to include.
  • The “active=true” or “active=false” filter can be used to restrict the result set to specifically Active or specifically Inactive work items.  Not including this filter will retrieve all instances.
  • An abbreviation for “active=true” is simply “active”

Where Available

  • Metric expression
  • Attribute expression

Examples

Where Example(s)
Metric expression

 

averageif(Initiative__t, OPEX__m)

averageif(Initiative__t, OPEX__m, active=true and business_unit__c = "West")

averageif(Initiative__t, (OPEX__m + CAPEX__m) * currency_conversion__c, active=true and business_unit__c = "West")

Attribute expression
averageif(Task__t, Hours_Worked__c)

averageif(Task__t, Hours_Worked__c, Priority="High")

 

Updated on February 7, 2023

Related Articles