Skip to main content

Hi, Can anyone help me to calculate time difference between LAST TWO activities in the process where last two activities are not fixed ones.

  • June 20, 2024
  • 4 replies
  • 46 views

sivasakthi.dhand
Level 4
Forum|alt.badge.img+4

Hi, Can anyone help me to calculate time difference between LAST TWO activities in the process where last two activities are not fixed ones. Thanks in advance!

4 replies

Forum|alt.badge.img+8

Hi Sivasakthi,

 

To find the time difference between two activities where the last two activities are not fixed ones, I would suggest using variables so that one can manually assign the desired activity as required.

 

You can have a view on the front end with an input dropdown for your activity list and build the formula for the same as :

 

CALC_THROUGHPUT ( FIRST_OCCURRENCE [ 'variable1' ] TO FIRST_OCCURRENCE [ 'variable2' ] , REMAP_TIMESTAMPS ( "Table1"."TIMESTAMP" , MINUTES ) )

 

You can find more information here :

Calc_throughput : Link

Variables : Link

 

Please let me know if i can help you further on this.

 

Best,

Riddhi

 


sivasakthi.dhand
Level 4
Forum|alt.badge.img+4

Hi Riddhi, Thanks very much for your response. I will not have the name of the last two activities. ie I need to find time difference for last two activities of all active cases. So I can not pass values thru variables in this scenario. Please suggest if there is an alternate way. Thanks!


Forum|alt.badge.img+6

Hi @sivasakthi.dhand ,

 

Hope my answer helps you out.

 

HOURS_BETWEEN(

 

PU_LAST(CASE_TABLE, ACTIVITY_EVENTTIME, ACTIVITY_COLUMN=ACTIVITY_LAG(PU_LAST(CASE_TABLE, ACTIVITY_COLUMN, ORDER BY ACTIVITY_EVENTTIME DESC),1)), --Last second activity eventtime.

 

PU_LAST(CASE_TABLE, ACTIVITY_EVENTTIME) -- last activity eventtime.

)

 

Do let me know if it works. Apologies if any syntax error.

 

Regards,

Sachin


sivasakthi.dhand
Level 4
Forum|alt.badge.img+4

Hi @sivasakthi.dhand ,

 

Hope my answer helps you out.

 

HOURS_BETWEEN(

 

PU_LAST(CASE_TABLE, ACTIVITY_EVENTTIME, ACTIVITY_COLUMN=ACTIVITY_LAG(PU_LAST(CASE_TABLE, ACTIVITY_COLUMN, ORDER BY ACTIVITY_EVENTTIME DESC),1)), --Last second activity eventtime.

 

PU_LAST(CASE_TABLE, ACTIVITY_EVENTTIME) -- last activity eventtime.

)

 

Do let me know if it works. Apologies if any syntax error.

 

Regards,

Sachin

Thanks a lot Sachin. Your solution helps out. I simplified as below.

pu_last("Cel_Case",REMAP_TIMESTAMPS ( "Cel_Activities"."event_date", days )) - pu_last("Cel_Case",REMAP_TIMESTAMPS ( ACTIVITY_LAG ( "Cel_Activities"."event_date",1), days ))