Throughput time between activities followed directly

Dear all,

How can we calculate a throuput time between 2 activities, but only when the activities are directly linked ?

An example: I need to calculate the lead-time in orange.
With this formula the result is not correct, because there is an other A2 activity later in the process (it could also happen that this additional A2 activity, not directly coming from A1 occurs before in the process)

AVG(CASE WHEN (PROCESS EQUALS ‘A1’ TO ‘A2’)
THEN CALC_THROUGHPUT(FIRST_OCCURRENCE[‘A1’] TO LAST_OCCURRENCE[‘A2’], REMAP_TIMESTAMPS("_CEL_ACTIVITIES_NC".“EVENTTIME”, HOURS))
ELSE NULL END)

Thank you for your help,
Best Regards
Robin

Hi Robin,
Check out the source/target functions: Feature of the week series #17 - Source Target
Best regards,
Pol