Skip to main content

Celonis Product Documentation

INDEX_ACTIVITY_ORDER_REVERSE
Description

INDEX_ACTIVITY_ORDER_REVERSE returns the reverse position of each activity within a case. Only not null activities are counted.

Syntax
  INDEX_ACTIVITY_ORDER_REVERSE ( activity_table.column )
 
  • activity_table.column: A column of an activity table. Usually, the activity column of an activity table is used.

NULL handling

If a row is NULL, then NULL will also be returned. NULL values do not influence the position of the non-NULL activities.

[1]

INDEX_ACTIVITY_ORDER_REVERSE with null values.

Query

Column1

         INDEX_ACTIVITY_ORDER_REVERSE ( "Table1"."ACTIVITY" )
        

Input

Output

Table1

CASE_ID : string

ACTIVITY : string

TIMESTAMP : date

'1'

'A'

Tue Jan 01 2019 13:00:00.000

'1'

'B'

Tue Jan 01 2019 13:01:00.000

'1'

null

Tue Jan 01 2019 13:02:00.000

'2'

'A'

Tue Jan 01 2019 13:03:00.000

'2'

null

Tue Jan 01 2019 13:04:00.000

'3'

'A'

Tue Jan 01 2019 14:00:00.000

'3'

null

Tue Jan 01 2019 14:05:00.000

'3'

'D'

Tue Jan 01 2019 14:10:00.000

'3'

null

Tue Jan 01 2019 14:11:00.000

Result

Column1 : int

2

1

null

1

null

2

null

1

null

Result

INDEX_ACITIVTY_ORDER_REVERSE returns an INT column which gives for each not null activity in the activity table the reverse position within a case. The resulting column is temporarily added to the activity table.

Examples

[2]

Example with two cases in which each activity is taken into account.

Query

Column1

         INDEX_ACTIVITY_ORDER_REVERSE ( "Table1"."ACTIVITY" )
        

Input

Output

Table1

CASE_ID : string

ACTIVITY : string

TIMESTAMP : date

'1'

'A'

Tue Jan 01 2019 13:00:00.000

'1'

'B'

Tue Jan 01 2019 13:01:00.000

'1'

'B'

Tue Jan 01 2019 13:02:00.000

'2'

'A'

Tue Jan 01 2019 13:03:00.000

'2'

'B'

Tue Jan 01 2019 13:04:00.000

Result

Column1 : int

3

2

1

2

1

[3]

Example with two cases in which only B values are taken into account.

Query

Column1

         INDEX_ACTIVITY_ORDER_REVERSE ( REMAP_VALUES ( "Table1"."ACTIVITY" , [ 'A' , NULL ] ) )
        

Input

Output

Table1

CASE_ID : string

ACTIVITY : string

TIMESTAMP : date

'1'

'A'

Tue Jan 01 2019 13:00:00.000

'1'

'B'

Tue Jan 01 2019 13:01:00.000

'1'

'B'

Tue Jan 01 2019 13:02:00.000

'2'

'A'

Tue Jan 01 2019 13:03:00.000

'2'

'B'

Tue Jan 01 2019 13:04:00.000

Result

Column1 : int

null

2

1

null

1

See also: