Skip to main content

Hello everyone,

 

I'm trying to calculate wit PQL different metrics like the Number of cases which flow through a certain process with specified activities . I'm using activity_lead and pu_first for that. For example (this is the PIZZA CASE):

SUM(

  CASE

  WHEN PU_FIRST("CASE_TABLE", "EVENT_TABLE"."ACTIVITY_EN") = 'Order by phone'

    AND ACTIVITY_LEAD("EVENT_TABLE"."ACTIVITY_EN", 1) = 'Start preparing pizza'

    AND ACTIVITY_LEAD("EVENT_TABLE"."ACTIVITY_EN", 2) = 'Start baking pizza'

    AND ACTIVITY_LEAD("EVENT_TABLE"."ACTIVITY_EN", 3) = 'Baking pizza ready'

    AND ACTIVITY_LEAD("EVENT_TABLE"."ACTIVITY_EN", 4) = 'Plan route'

    AND ACTIVITY_LEAD("EVENT_TABLE"."ACTIVITY_EN", 5) = 'Departure pizza'

    AND ACTIVITY_LEAD("EVENT_TABLE"."ACTIVITY_EN", 6) = 'Pizza arrives at customer'

    AND ACTIVITY_LEAD("EVENT_TABLE"."ACTIVITY_EN", 7) = 'Payment customer'

    THEN 1

  ELSE 0

END)

 

I use PU_first because I want to select the first activity for all the cases in the Case_Table the activity 'Order by phone'.

i am not getting the correct number of cases which flow trough the process that I'm trying to define here. I dont understand why.

 

Anyone knows?

 

many thanks

Be the first to reply!

Reply