Skip to main content

PQL47 (PQL Function Library - CPM 4.7)

CALC_REWORK

Applies to: CELONIS 4.0 CELONIS 4.2 CELONIS 4.3 CELONIS 4.4 CELONIS 4.5 CELONIS 4.6 CELONIS 4.7

Description

CALC_REWORK counts the number of activities per case. A filter expression can be specified to restrict the activities that should be taken into account.

Syntax
CALC_REWORK ()
CALC_REWORK ( filter_condition )
CALC_REWORK ( table.column )
CALC_REWORK ( filter_condition , table.column )
  • filter_condition: All activities that match the filter condition will be counted.

  • table.column: Column which has to be joinable to an activity table (Since: CELONIS 4.6). This can be used to specify the event log that should be used if multiple event logs are contained in the data model.

NULL handling

NULL values are in general not relevant for the calculation since CALC_REWORK counts how often a CASE_ID appears. However, if a case does not have a join partner in the case table, it will be ignored. If there is a NULL case id in the case table, it will be taken over into the result table. However, the result for it will be 0 since NULL cases are not joined.

[1] CALC_REWORK with NULL values in the activity table. The first element in the result table represents the NULL case. However, NULL values in the activity table are ignored. Therefore, the result is 0.

Query

Column1

CALC_REWORK ( )

Input

Output

ACTIVITY_TABLE

CASE_ID : STRING

ACTIVITY : STRING

TIMESTAMP : DATE

'1'

null

Tue Jan 01 2019 13:00:00.000

null

'A'

Tue Jan 01 2019 13:00:00.000

null

'A'

Tue Jan 01 2019 13:04:00.000

'2'

'B'

Tue Jan 01 2019 13:01:00.000

'2'

null

Tue Jan 01 2019 13:02:00.000

'2'

'D'

Tue Jan 01 2019 13:03:00.000

'3'

'A'

Tue Jan 01 2019 13:04:00.000

'3'

null

Tue Jan 01 2019 13:05:00.000

null

'B'

Tue Jan 01 2019 13:06:00.000

CASE_TABLE

CASE_ID : STRING

null

'1'

'2'

'3'

Foreign Keys

CASE_TABLE.CASE_ID

ACTIVITY_TABLE.CASE_ID

Result

Column1 : INT

0

1

3

2

Examples

[2] Example for CALC_REWORK on 3 cases without filter.

Query

Column1

CALC_REWORK ( )

Input

Output

Activities

CASE_ID : STRING

ACTIVITY : STRING

TIMESTAMP : DATE

'1'

'A'

Tue Jan 01 2019 13:00:00.000

'2'

'B'

Tue Jan 01 2019 13:01:00.000

'2'

'C'

Tue Jan 01 2019 13:02:00.000

'2'

'D'

Tue Jan 01 2019 13:03:00.000

'3'

'A'

Tue Jan 01 2019 13:04:00.000

'3'

'A'

Tue Jan 01 2019 13:05:00.000

Result

Column1 : INT

1

3

2

[3] Example for CALC_REWORK on 3 cases without filter. The activity column that should be used is passed as a parameter. This can be used to specify the event log that should be used if multiple event logs are contained in the data model.

Query

Column1

CALC_REWORK ( "Activities"."ACTIVITY" )

Input

Output

Activities

CASE_ID : STRING

ACTIVITY : STRING

TIMESTAMP : DATE

'1'

'A'

Tue Jan 01 2019 13:00:00.000

'2'

'B'

Tue Jan 01 2019 13:01:00.000

'2'

'C'

Tue Jan 01 2019 13:02:00.000

'2'

'D'

Tue Jan 01 2019 13:03:00.000

'3'

'A'

Tue Jan 01 2019 13:04:00.000

'3'

'A'

Tue Jan 01 2019 13:05:00.000

Result

Column1 : INT

1

3

2

[4] Example for CALC_REWORK with filter on activities B and C.

Query

Column1

CALC_REWORK ( "Activities".ACTIVITY IN ( 'B' , 'C' ) )

Input

Output

Activities

CASE_ID : STRING

ACTIVITY : STRING

TIMESTAMP : DATE

'1'

'A'

Tue Jan 01 2019 13:00:00.000

'2'

'B'

Tue Jan 01 2019 13:01:00.000

'2'

'C'

Tue Jan 01 2019 13:02:00.000

'2'

'D'

Tue Jan 01 2019 13:03:00.000

'3'

'A'

Tue Jan 01 2019 13:04:00.000

'3'

'A'

Tue Jan 01 2019 13:05:00.000

Result

Column1 : INT

0

2

0

[5] Example for CALC_REWORK with filter on activities B and C with specified activity column. This can be used to specify the event log that should be used if multiple event logs are contained in the data model.

Query

Column1

CALC_REWORK ( "Activities".ACTIVITY IN ( 'B' , 'C' ) , "Activities".ACTIVITY )

Input

Output

Activities

CASE_ID : STRING

ACTIVITY : STRING

TIMESTAMP : DATE

'1'

'A'

Tue Jan 01 2019 13:00:00.000

'2'

'B'

Tue Jan 01 2019 13:01:00.000

'2'

'C'

Tue Jan 01 2019 13:02:00.000

'2'

'D'

Tue Jan 01 2019 13:03:00.000

'3'

'A'

Tue Jan 01 2019 13:04:00.000

'3'

'A'

Tue Jan 01 2019 13:05:00.000

Result

Column1 : INT

0

2

0