Skip to main content
Question

TPT with SOURCE and TARGET for a particular sequence

  • September 9, 2021
  • 3 replies
  • 11 views

Forum|alt.badge.img+7

Hi,

I am interested in two particular sequences A->B->C and A->C that may have none or multiple occurrences within one case (A ,B and C are activities and the connexion "->" is not necessarily direct).

 

Important: The activity A is always followed (directly or not) by the activity C. That means that I can't have A->A->C or A->C->C, but I may have A->C->A->C.

 

I would like to calculate two KPIs:

  • KPI1: Average TPT between A and B when I am in a A->B->C sequence,
  • KPI2: Average TPT between A and C when I am in a A->C sequence.

 

For instance: Let's say I want to calculate KPI1, and one of my cases is:

 

Start >> ... >> A1 >> C1 >>... >> A2 >> ... >> B1 >> C2 >> ...>> B2 >> ... >> A3 >> B3 >> C3 >> ... >> End.

 

For that case, the result should be ( (tB1-tA2) + (tB3-tA3) )/2 (with t- being the timestamp)

 

I tried the following, but it seems to return null because the case starts with A->A->B and not A->B.

Component filter:

  • FILTER SOURCE("activities"."activity") ='A';
  • FILTER TARGET("activities"."activity") ='B';

KPI:

  • DAYS_BETWEEN ( SOURCE("ACTIVITIES"."TIMESTAMP_ACTIVITY"), TARGET("ACTIVITIES"."TIMESTAMP_ACTIVITY") )

 

Can you please help me on this ?

 

Thanks a lot !

 

Diane

 

3 replies

Forum|alt.badge.img+2

Hi Diane,

 

I would suggest to use ACTIVITY_LEAD instead of SOURCE/TARGET to make it easier to handle the 3-activity-sequence.

 

KPI1:

AVG(CASE WHEN "Activities"."Activity" = 'A'

AND ACTIVITY_LEAD(CASE WHEN "Activities"."Activity" IN ('A', 'B','C') THEN "Activities"."Activity" ELSE NULL END, 1) = 'B'

AND ACTIVITY_LEAD(CASE WHEN "Activities"."Activity" IN ('A', 'B','C') THEN "Activities"."Activity" ELSE NULL END, 2) = 'C'

THEN DAYS_BETWEEN( "Activities"."Timestamp", ACTIVITY_LEAD(CASE WHEN "Activities"."Activity" IN ('A', 'B','C') THEN "Activities"."Timestamp" ELSE NULL END, 1) )

ELSE NULL END)

 

KPI2:

AVG(CASE WHEN "Activities"."Activity" = 'A'

AND ACTIVITY_LEAD(CASE WHEN "Activities"."Activity" IN ('A', 'B','C') THEN "Activities"."Activity" ELSE NULL END, 1) = 'C'

THEN DAYS_BETWEEN( "Activities"."Timestamp", ACTIVITY_LEAD(CASE WHEN "Activities"."Activity" IN ('A', 'B','C') THEN "Activities"."Timestamp" ELSE NULL END, 1) )

ELSE NULL END)

 

The idea is to get the next and the next but one row which is either A, B or C with the ACTIVITY_LEADs and use this information inside the CASE WHEN to specify the process flow and distinguish between the sequences.

 

Hope this helps!

 

Best

David


Forum|alt.badge.img+7
  • Author
  • Level 1
  • September 21, 2021

Hi David,

 

Thank you so much for your answer. I think it is exactly what I needed !

But now I have an error message saying "Invalid operator type ACTIVITY_LEAD" ... I might have made a mistake so I will check again on my side.

 

Thank you again for your precious time !

 

Best

Diane


Forum|alt.badge.img+2

Hi Diane,

 

can you tell me which Celonis Product you are using? If you are on a rather old on-prem CPM4 version (e.g. CPM4.5), this function is not yet supported unfortunately.

 

Best

David