Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

calculating an average

Hi

I am trying to calculate the average processing time based on the difference between datetimeprocessed and datetimereceived.. But I only want to calculate the average for rows where there is a value in datetimeprocessed field.

I am trying to use the following expression to achieve this:

=sum(Interval(DateTimeProcessed-DateTimeReceived))/$Rows

I am not sure if the above is correct. Can someone please help me with getting the correct expression.

Thanks

2 Replies
hic
Former Employee
Former Employee

Avg(DateTimeProcessed-DateTimeReceived) should work. Or you can use

Sum(DateTimeProcessed-DateTimeReceived)/Count(DateTimeProcessed-DateTimeReceived)

In both cases, DateTimeProcessed-DateTimeReceived is evaluated to NULL when one of the fields is missing, and will then not be included.

HIC

Not applicable
Author

Hi Henric

Your suggested solution works perfectly.

Thanks