Skip to main content
Question

Comparing timestamps of 2 cases

  • May 26, 2025
  • 2 replies
  • 43 views

denise.kruge12
Level 7
Forum|alt.badge.img+15

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?

2 replies

Rami Agha Kassab
Level 3

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")


denise.kruge12
Level 7
Forum|alt.badge.img+15
  • Author
  • Level 7
  • 23 replies
  • May 30, 2025

Good morning Rami, thank you very much for your assistance, I will try it out. Regards,

Denise