Skip to main content

Celonis Product Documentation

CONSTANT
Description

To aggregate all values from a source column to a single value, the CONSTANT function can be used as a target table inside a PU-function. The resulting value is a constant.

Syntax
 CONSTANT()
Examples

[1]

Calculate the average of the case table values using CONSTANT:

Query

Column1

         PU_AVG ( CONSTANT ( ) , "caseTable"."value" )
        

Input

Output

caseTable

caseId : int

companyCode : string

value : int

1

'001'

600

2

'001'

400

3

'001'

200

4

'002'

300

5

'002'

300

6

'003'

200

Result

Column1 : float

333.33

[2]

Calculate the average of the case table values using CONSTANT. In contrast to the regular AVG function, and like in all PU-functions, FILTERs are ignored:

Query

Filter

         FILTER "caseTable"."caseId" = 1;
        

Column1

         PU_AVG ( CONSTANT ( ) , "caseTable"."value" )
        

Input

Output

caseTable

caseId : int

companyCode : string

value : int

1

'001'

600

2

'001'

400

3

'001'

200

4

'002'

300

5

'002'

300

6

'003'

200

Result

Column1 : float

333.33

[3]

In this example, only company codes with an average value larger than the overall average value are returned. The overall average value is calculated using CONSTANT inside a PU_AVG. The result of this behaves like a constant value, such that it can be compared with the result of the first PU_AVG which calculates the average value per companyDetail:

Query

Filter

         FILTER PU_AVG ( "companyDetail" , "caseTable"."value" ) > PU_AVG ( CONSTANT ( ) , "caseTable"."value" );
        

Column1

         "companyDetail"."companyCode"
        

Input

Output

caseTable

caseId : int

companyCode : string

value : int

1

'001'

600

2

'001'

400

3

'001'

200

4

'002'

300

5

'002'

300

6

'003'

200

companyDetail

companyCode : string

country : string

'001'

'DE'

'002'

'DE'

'003'

'US'

Foreign Keys

caseTable.companyCode

companyDetail.companyCode

Result

Column1 : string

'001'