Feature of the week series #17 - Source Target


Dear Celonis Community!

Take a small breath for today’s feature of the week is a short PQL deep dive: Do you know the PQL siblings SOURCE and TARGET?

Use Case

You should, because they are incredibly helpful to compare attributes of different activities from the Eventlog. We can use them very flexibly to answer diverse process questions like:

  • How much time passed between two activities?

  • Did the same department perform two activities?

This last question is an example for the business use case of Segregation of Duties.
Segregation of Duties means that we want to avoid that two activities (for example “Approval Requested” and “Approval Granted”) of a case were performed by the same department. But if that is the case, we as Segregation of Duties guardians want to label these cases as violation to our rules:

But how to identify those cases in Celonis? How to compare the activities by its “Department” attributes? This post provides below a high level overview how this question can be answered with SOURCE and TARGET. If you have time for the step-to-step guide how those functions are used to answer this question, go to the new Examples category in the PQL function library on the IBC or look at this export from the IBC documentation (255.7 KB)
. Soon, this attached documentation will of course be available for the on premise help as well.

And here is the high level solution overview

To compare two activities, the first step is to list all connections between two activities of all cases in a table. The function

SOURCE( activitiy_column )

picks for all connections of a case the starting activity and displays the attribute (column) that we specify. The function

TARGET( activitiy_column )

will display the ending activity attribute of this connection. Here is an example where we show all activity names of the connections:

This is great. In the above Segregation of Duties use case, we want to compare the departments. So in the next step, we don’t only display the activity names, but compare the departments of the source activity and the target activity:

If we were interested in direct connections in our Eventlog, we would be already at our goal. We can compare attributes of activities!

But for many use cases, we only want to compare specific events. Above it was “Approval Requested” and “Approval Granted”. In the below example, we only want to compare “A” and “C” activities. To only look at those, the SOURCE and TARGET functions allow us to filter or select only those activities from the Eventlog that we are interested in, by mapping all other activities to NULL:

For this high-level overview, we only show the FILTER_STATEMENT as a placeholder for the real code, which you can explore in the documentation above.

Now you are all set. You can flexibly compare attributes between activities! The Source and Target functions provide even more flexibility by letting you define what it considers as connections (e.g. the connection from one to the next activity, or the connection from the first to any activity, …) which you can read of in the documentation.

We hope you found this interesting. Happy Process Mining!
Your Celonis Product team

From a specific activity to the "NEXT" one
How to display a sub-process in process explorer?
Connection KPI for custom Activity KPI
pinned globally #2

Thanks for the detailed explanation. I found source/target one of the more complicated but also more powerful PQL functions!

I don’t have access to the IBC so tried to click the ‘export from IBC documentation’ link but got an error. Maybe others are experiencing the same issue?


Hi Joos,

Thanks for your feedback! I updated the documentation link :slight_smile:

Cheers, Max