How to create an overview of linked events


Dear Community,

I would like to create an overview which shows for a given Event/Activity (dropdown and pull into variable “x”) the direct “activity-neighbors”, each before and after the given activity, with case-count.

So the result is, I can select an acitivity and see the most relevant activities before and after the one I selected. (I know its basically all in the process explorer, however it’s far more convenient to see at a glance)

Limitation: we have at the moment the version 4.3. (no source/target statement). I tried with match_process but got stucked.

Thank you for your support.



Dear Johannes,

Source/Target is the function you need to use to solve your problem. However, the good news is you should be able to use it as when I checked the documentation its tagged as being available for Celonis 4.3. I suspect the misunderstanding comes for the fact that it isn’t currently listed in the PQL reference list visible in Celonis itself. I would recommend reading up on SOURCE/TARGET operations in PQL documentation (found by opening the Celonis help page and searching for SOURCE/TARGET) as they are useful for a wide range of use cases like this one.

Before launching into a step by step guide of how to build the overview of 'activity-neighbours’ I will try to briefly explain how it works.

The SOURCE / TARGET operations where developed to enable calculations to be made on the relationship between activities to be made on an activity level rather than a case one, this is particularly important for activities that can take place multiple times.

To use them you create a table with dimensions which define the source (first activity) and the target (second activity). Source and Target include an option to define how they relate to each other; the default is for the source to be the activity immediately precede the target activity. When you add a KPI like ‘average throughput time between activities’ activities are only used in the calculation if have the relationship specified in Source and Target. I.e for the row containing the activities ‘A’ and ‘B’ the calculation of the average throughput time would only use time -stamps of a particular pair of ‘A’ and ‘B’, belonging to the same case, if ‘A’ is immediately followed by ‘B’.

Here is how to apply SOURCE / TARGET to your particular use case:

  1. Create a button dropdown to select the Activity coded to the variable X.

Note: it’s important that the wrapping characters are single quotation marks (’)

  1. Create an OLAP table with the following two dimensions:



  1. Add a KPI which counts the occurrences of the target activity directly following the source activity (this is not the same thing as case count as activities (and there for connections) can happen multiple times in one case).


(If case count really is what you want then I would suggest using this code instead to avoid the same case being counted twice:


  1. Make a copy the table. Name one something like "Activities directly before <%= X %>" and the other "Activities directly before <%= X %>"

  2. To make the tables only display the relevant combinations of activities, add the filter “FILTER TARGET ( “ACTIVITIES”.“ACTIVITY” ) = <%= X %>” to the ‘before’ table and “FILTER SOURCE ( “ACTIVITIES”.“ACTIVITY” ) = <%= X %>” to the ‘after’ table.

  3. (Optional) To make the tables tidier you can hide the ‘target’ dimension in the ‘before’ table and the ‘source’ dimension in the ‘after’ table so you don’t have columns of the same activity name.

I hope this answers your question, if not feel free to write back.

Best wishes,

Calandra (Celonis Data Science Team)



Hello Calandra,

Thank you so much, this is it. Source/Target seems to be a really powerful thing.

Best, Johannes

1 Like