Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
MattG
Contributor II
Contributor II

Average of Interval unexpected result

In my script I have an interval.  Interval(DateTime2 - DateTime1,'mm') as MyInterval to get the minutes between two date times.

This returns the expected value.

If I select just one record, the interval is 63

Sum(MyInterval) = 63 Count(MyInterval)=1  Median(MyInterval) = 63  which is correct.

However avg(MyInterval) = 0.044131944

Why is this output for the average function and how do I have it return the average of my value.

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In Qlik, times are represented as the fraction of a day. 0.5 = noon.  So 044131944 * 1440 minutes in a day = 63 minutes. Avg is returning the correct value. You just need to apply the Interval formatting function if you want to see it as minutes 

Interval(avg(MyInterval), 'mm')

-Rob

View solution in original post

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

In Qlik, times are represented as the fraction of a day. 0.5 = noon.  So 044131944 * 1440 minutes in a day = 63 minutes. Avg is returning the correct value. You just need to apply the Interval formatting function if you want to see it as minutes 

Interval(avg(MyInterval), 'mm')

-Rob