Skip to main content

Good morning all, I need assistance with PQL to compare the timestamp of a certain activity of case A with the timestamp of another activity of case B, has anyone done this before?

If you’re comparing two specific cases use the following PQL 
 

VAR_A = 
  ACTIVITY_TIMESTAMP(
    FILTER "ACTIVITY" = 'Activity X' AND "CASE_ID" = '1001'
  )

VAR_B = 
  ACTIVITY_TIMESTAMP(
    FILTER "ACTIVITY" = 'Activity Y' AND "CASE_ID" = '1002'
  )

DURATION_BETWEEN(VAR_A, VAR_B, "MINUTES")


But if you want to compare across all cases dynamically:

1- Duplicate the activity table in the data model (self-join on activity name or any logic)

2- Assign aliases like A.ACTIVITY_TIME, B.ACTIVITY_TIME

3- Join based on your matching condition (e.g., compare timestamps of same activity across related cases)

Then apply: DURATION_BETWEEN("A"."EVENTTIME", "B"."EVENTTIME", "HOURS")


Reply