Activity Selection in PQL Syntax


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))


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:


MATCH_ACTIVITIES(STARTING[‘Vendor creates Invoice’] NODE[‘Archive Invoice’, ‘Create VIM Document’, ‘Workflow Start’, ‘Enter in SAP’] EXCLUDING[‘Geschäftsregeln anwenden’] ) = 1


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 don’t 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 wasn’t 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