Skip to main content
Hello, I don`t know what is the correct PQL Syntax for this Activity Selection for my KPI Component option (see screenshot). Thanks in advance for your responses :o))

image.png1061476 22.5 KB
Hi Carlo,
Welcome to the Celonis community.
For your use case I would recommend using a Case When statement in combination with the Match Activities function.
Here is the PQL statement I would suggest you use:
SUM( CASE WHEN
MATCH_ACTIVITIES(STARTING[Vendor creates Invoice] NODE[Archive Invoice, Create VIM Document, Workflow Start, Enter in SAP] EXCLUDING[Geschftsregeln anwenden] ) = 1
THEN 1 ELSE 0 END)
MATCH_ACTIVITIES returns a 1 for all cases where the activities fulfil the conditions stated in the function. STARTING specifies that the function must start with Vendor creates Invoice. NODE accepts a list of all the activities that must take place for the case to be accepted and EXCLUDING is where you list the activities you dont want to have. CASE WHEN requires a logical expression(s) where those cases with TRUE get the value specified by THEN and the rest get the value specified with ELSE. In the code above, for all the cases for which MATCH_ACTIVITIES returns 1, the CASE WHEN Statement returns a 1 and for all others a 0. The 1s and 0s are then aggregated using SUM giving the count of conforming cases.
Its wasnt clear from your post whether you want a total number of the cases fulfilling your conditions or an average, with respect to a dimension. If you want the average, then just substitute AVG for SUM in the code above.
I hope this helps, write back if you have further questions.
Best Wishes,
Calandra (Celonis Data Science Team)
Hello Calandra, thanks for the quick response. It works. Best regards

Reply