Applies to:
Status | ||||
---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Description
Calculates the average of the specified column for each element of the given parent table.
Like the regular AVG operator, the column can either be an INT or FLOAT column. The data type of the result is the same as the data type of the input column.
If no value in the child table exists for the element in the parent table (either because all values of the child table column are filtered out, or because no corresponding value exists in the first place), NULL will be returned.
Syntax
Code Block | ||||
---|---|---|---|---|
| ||||
PU_AVG ( parent_table, child_table.column [, filter_expression] ) |
Code Block | ||||
---|---|---|---|---|
| ||||
PU_AVG ( DOMAIN_TABLE ( column1,...,columnN ), child_table.column [, filter_expression] ) |
Examples
Calculate the average of the case table values for each company code:
Panel | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
Column1
Column2
|
Calculate the average of the case table values for each company code. Only consider cases with an ID larger than 2:
Panel | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
Column1
Column2
|
Calculate the sum of the case table values for each company code. Only consider cases with an ID larger than 3. All case table values for companyCode '001' are filtered out, which means that in this case, NULL is returned.
Panel | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
Column1
Column2
|
Panel | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
Column1
Column2
|
DOMAIN_TABLE
:title | Query |
---|
Column1
Code Block | ||||
---|---|---|---|---|
| ||||
"caseTable"."caseId" |
Column2
Code Block | ||||
---|---|---|---|---|
| ||||
PU_AVG(DOMAIN_TABLE("caseTable"."companyCode"), "caseTable"."value") |