Hi Marco,
Since you introduce the join to the Activity table, the sum will be based on the Activity table accordingly. So whenever "EKPO"."LABNR"=1
, the number of activities for this case will contribute to the sum.
I assume you want to apply the KPI on case level, e.g. count the ratio of cases where "EKPO"."LABNR"=1
or which contain the activity 'Create Order Confirmation'
at least once.
In this case, I would suggest to not introduce the Join with the Activity table, but use PROCESS EQUALS instead to keep it on Case table level. You can then also use AVG to calculate your KPI:
AVG ( CASE WHEN "EKPO"."LABNR"=1 OR PROCESS EQUALS 'Create Order Confirmation' THEN 1 ELSE 0 END )
Best
David