Custom Kpi on first or last connection

Hi Community,
I am trying custom KPI and basically got the figures I want.
But first and last connections (dotted ones) that is from Process Start or to Process End
do not show KPIs.
I tried source(table.column) and target(table.column) functions both, but neither seemed work.
Is there any way I can get KPIs on first and last connections?
Thank you.

Hi,

Welcome to the Celonis Community :slight_smile:

The dotted lines going from Process Start (and to Process End) aren’t actually connections between activities. They just denote which activities the variants being displayed start (or end) with. This is why you can’t treat Process Start as an activity because it’s not one. There are ways of specifying in your KPIs that a certain activity must be the first (or last) one to take place for the case to be included.

You didn’t mention any KPIs you are particularly interested in so I’m going to use the following use case as an example to talk about some PQL functions you can use:

KPI: Count the number of cases which start with Activity ‘A’.

  1. Using “PROCESS EQUALS”:

COUNT(DISTINCT
CASE WHEN
PROCESS EQUALS START ‘A’
THEN “_CEL_P2P_ACTIVITIES”."_CASE_KEY"
ELSE NULL END)

If the first activity for the case is ‘A’ then PROCESS EQUALS returns a TRUE, so it’s Case Key is returned by the code crunch CASE WHEN … END, as that is what is specified after the THEN. If it doesn’t start with activity ‘A’ then PROCESS EQUALS returns a FALSE triggering the ELSE part of the case when statement, which in this case returns a NULL instead of a case key. Finally, all the unique CASE KEYS are counted ignoring all NULLs.

Instead of Process equals you can also use:

  1. Using “MATCH_ACTIVITIES”

COUNT(DISTINCT
CASE WHEN
MATCH_ACTIVITIES ( “Table1”.“ACTIVITY”, STARTING[ ‘A’ ]) = 1
THEN “_CEL_P2P_ACTIVITIES”."_CASE_KEY"
ELSE NULL END)

MATCH_ACTIVITIES returns a 1 for cases which fulfils the specified conditions and 0 if it doesn’t, so MATCH_ACTIVITIES(…) = 1 returns either TRUE or FALSE which then controls whether the case is included in the count or not.

If you instead want to count the cases where ‘B’ is the last activity it works, the same way:

For Process Equals write:

PROCESS EQUALS ‘B’ END

and for Match Process write:

MATCH_ACTIVITIES ( “Table1”.“ACTIVITY”, ENDING [ ‘B’ ]) = 1

Finally, if you want to count the cases which start with ‘A’ and end with ‘B’ you can write:

PROCESS EQUALS START ‘A’ TO ANY TO ‘B’ END

or

MATCH_ACTIVITIES ( “Table1”.“ACTIVITY”, STARTING[ ‘A’ ], ENDING [ ‘B’ ]) = 1

If you ever what to flip it around to count the cases where the conditions is not fulfilled just add a NOT to Process equals i.e.

PROCESS NOT EQUALS …

or with MATCH_ACTIVITIES test where its equals to 0.

MATCH_ACTIVITIES ( … ) = 0

I hope this has helped you gain a better understanding. I wanted to illustrate that in Celonis there are often multiple ways of achieving the same goal. I find PROCESS EQUALS more intuitive and easier to use but MATCH_ACTIVITIES is far more flexible and powerful in complicated use cases. I recommend you read up on PROCESS EQUALS and MATCH_ACTIVITIES in the PQL library section of the help pages.

If you need any help with working out the code for any concrete KPIs feel free to make another post and we’ll help you out.

Best wishes,

Calandra

Hi Calandra,

Thank you for your advice.
I’ll read the manual of those functions and try them.

I’m new to the community. Am I supposed to close the case?

Best wishes,
Takayoshi

Hi,

I’m glad you found my answer helpful :grin:

You can mark my answer as the solution to your problem by clicking on the “…” next to Reply at the bottom of my post. That will make extra Icons appear, if you click on the box icon the tread will be marked as solved.

Have a good day,
Calandra

Hi,

Thank you again. I’ve done that.

Best regards,
Takayoshi