Which occurrence does PU_AVG consider for calculation

Suppose I am using PU_AVG function to calculate time between ticket deferred and ticket released activity for each case but in my scenario there are multiple combinations of ticket deferred and ticket released so, will it pick all occurance per case or not.

Hi @Abhitndn

That depends on how you calculate the times, and at which point you apply the PU_AVG.
In general, the PU_AVG (like all PU functions) takes all values per case into account which are not null and which fulfill the filter condition of the PU function.
You can take a look at the documentation of the PU functions to learn more about this behavior.

Best
David

Thanks for your response David. My code is

(PU_AVG("_CEL_ITSM_CASES", REMAP_TIMESTAMPS("_CEL_ITSM_ACTIVITIES".ā€œEVENTTIMEā€, HOURS)*1.0,
ā€œCEL_ITSM_ACTIVITIES"."ACTIVITY<%=language%>ā€ = ā€˜Ticket Releasedā€™ )

-PU_AVG("_CEL_ITSM_CASES", REMAP_TIMESTAMPS("_CEL_ITSM_ACTIVITIES".ā€œEVENTTIMEā€, HOURS)*1.0,
ā€œCEL_ITSM_ACTIVITIES"."ACTIVITY<%=language%>ā€ = ā€˜Ticket Deferredā€™ ))

and we have multiple combinations of Ticket Released and Ticket Deferred so will this take average of all occurances or any specific one.

Hi @Abhitndn

this will take the average timestamp of all ā€œTicket Releasedā€ activities, and subtract the average timestamp of all ā€œTicket Deferredā€ activities.
The question is if that is what you actually want. If you want to calculate the average time between ā€œTicket Deferredā€ and ā€œTicket Releasedā€ activities, you might want to use SOURCE and TARGET functions inside the PU_AVG. With SOURCE and TARGET, you can calculate the throughput times between the two activities for each case before applying the average.
So you probably want to do something like this:

PU_AVG(  
"_CEL_ITSM_CASES", 
HOURS_BETWEEN( SOURCE( "_CEL_ITSM_ACTIVITIES"."EVENTTIME", REMAP_VALUES("_CEL_ITSM_ACTIVITIES"."ACTIVITY_EN", ['Ticket Released', ''], ['Ticket Deferred', ''], null) ), TARGET( "_CEL_ITSM_ACTIVITIES"."EVENTTIME") ),
SOURCE( "_CEL_ITSM_ACTIVITIES"."EVENTTIME") = 'Ticket Deferred'
)

This will also not take the time between ā€œTicket Releasedā€ ā†’ ā€œTicket Deferredā€ into account, but only the ā€œTicket Deferredā€ ā†’ ā€œTicket Releasedā€ edges.
For more information about SOURCE and TARGET, please take a look at the corresponding documentation.

Thanks and BR
David

1 Like

Thanks, David I think it solves my issue. The only doubt that remains is if there are multiple occurrences of ticket deferred ā†’ ticket released in one case will it include all occurrences and will it neglect activities between these pair as well if deferred and released are not directly followed eg (ticket deferred-> X ā†’ Y ā†’ ticket released)

Yes, it will take all pairs inside one case into account, and it will ignore activities between the two activities.
Example (one case):

Ticket Deferred
X
Y
Ticket Released
A
Ticket Deferred
Ticket Released

Here it would take the time between the first ā€œTicket Deferredā€ and the first ā€œTicket Releasedā€, as well as the time between the second ā€œTicket Deferredā€ and the second ā€œTicket Releasedā€.

You can test this if you filter on a single case and check if the value of the result matches the expected result.

Best
David

1 Like

Thanks, David for your help that worked perfectly.