From a specific activity to the "NEXT" one

Hello everyone,
is there a way to calculate a duration between a specific activity (lets say A) to the next activity (whichever it was).

Thank you!

Hello,

you can use the following code:

DAYS_BETWEEN(

PU_LAST(“CASE TABLE”, “activity table".“EVENTTIME”,

PROCESS_ORDER(“activity table".“ACTIVITY_EN”) =

PU_LAST(“CASE TABLE”, PROCESS_ORDER(“activity table".“ACTIVITY_EN”),

“activity table".“ACTIVITY_EN” = ‘A’)-1)

,

PU_LAST(“CASE TABLE”, “activity table".“EVENTTIME”, “activity table".“ACTIVITY_EN” = ‘A’)

)

The first PU_LAST function returns the event time of the activity immediately before Activity A for each case, by comparing PROCESS_ORDER to that of the activity 1 before Activity A. The days between the timestamp of this previous activity and activity A is calculated for each case. Note that if the activity takes place multiple time only the last instance of this activity will be included.

I hope this helps.

Best wishes,

Calandra (Celonis Data Science Team)

3 Likes

Hi DrWindy,

if you are interested in the average time between a specific activity to the “NEXT” one, you can make use of the Source Target function. Here is an example. I used two columns, a column for the source of every direct connection between activities:

SOURCE( "Eventlog"."Activity" )

And the average throughput time between this source and its (directly connected) target activity:

AVG( 
REMAP_TIMESTAMPS( TARGET( "Eventlog"."Timestamp" ) , MINUTES) - 
REMAP_TIMESTAMPS( SOURCE( "Eventlog"."Timestamp" ) , MINUTES)
)

I hope this helps. Here you can read more about the Source Target functions.

Cheers,
Max

Process:

Average Throughput time from a specific activity to the next one:

2 Likes

Thank you!

seems to work but could u pls explain, why u use -1 instead of +1 for the next activity?

Best,
Maria

Hi,

It depends on which dimension you want to record the time difference in. I.e. if you dimension is event time, do you want the time difference to be recorded at the time of the first activity (looking forward at the time until the next activity) or second activity (looking back at the time it took to get to this activity)? I was unsure what you wanted and picked the latter case for the example code. But if you want the former then yes using +1 works better.

I hope this makes more sense now.

Best,

Calandra

my dimension is actually the case ID, but now i understand what u mean. Thank you:)