Skip to main content

Hi,

is it possible to use a COUNT_TABLE together with CASE WHEN to form a KPI? Below Query works for a simple COUNT with “TABLE”.”COLUMN” in THEN, but doesn’t work for COUNT_TABLE.

 

COUNT_TABLE(CASE_WHEN(PROCESS EQUALS XY OR PROCESS EQUALS XZ) THEN "CASES" END)

 

Thanks!

Hi ​@fabian.altendorfer,

You can use SUM and CASE WHEN together to achieve this.

 

SUM(CASE WHEN PROCESS EQUALS XY THEN 1 ELSE 0 END)

This allows you to count the amount of cases that satisfy your case when statement.


Thanks Severre, how to add the data source in this Query then?


Do you mean for the PROCESS EQUALS function? It takes the activity table’s activity column automatically. Or do you mean something else?

https://docs.celonis.com/en/process-equals.html

Let me know what you want to achieve.


I wasn’t aware that PROCESS EQUALS automatically uses the activity column. With that in mind, the provided query provides what I was looking for, thanks a lot!


Glad it helped Fabian!

Consider marking my comment as the solution, so that it also may help others in the future! Good luck and have fun mining :)


Reply