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: 
rittermd
Master
Master

Need to Sum Results of Interval Function

I have the following calculation in my script.  It works perfectly to calculate the time difference.

If (endtime > starttime,

       Interval(endtime - starttime,'m,ss'),0)

                              as ProcessingMinutes,

However, when I attempt to Sum or to a Total in my Table Chart I do not get close to the correct answer.

For example the total based on my filter choices looks like a very large number.(in the thousands)  However, the total that is displayed using Sum(ProcessingMinutes) displays as 5.74.

I suspect it has to do with the result from the interval function and that I need to do some massaging or additional calculations on it before I can Sum it.

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Try doing this in the script... so the underlying value is not fraction, but a whole number....

If(endtime > starttime, (endtime - starttime) * 24 * 60, 0) as ProcessingMinutes,

View solution in original post

13 Replies
sunny_talwar

So, 5.74 is approx. 5 3/4th days... whereas the thousands could mean minutes, right? May be try this

Interval(Sum(ProcessingMinutes), 'm,ss')

sunny_talwar

I got 8,265 minutes and 36 seconds when converted 5.74 days to minutes and seconds

Capture.PNG

rittermd
Master
Master
Author

That did not change the result.

sunny_talwar

Where are you using this? In a chart? have you over-ridden the default format? Make sure you are going with default so that your expression can be formatted using Interval function.

rittermd
Master
Master
Author

I have tried it in a regular table and also in a KPI.  I don't get the correct result in either case.

I want the total to stay in the format of mm.ss and not convert to days or anything else.

sunny_talwar

I understand what you want and that is why I suggested you to use Interval() function. Is ~8265 not the right number you are looking to get Mark?

rittermd
Master
Master
Author

In a standard table I have no control over the Total calculation.  All I can do is pick Sum.  When I do that I do not get the correct number.

In the KPI I can do what you suggested.  But that is also not returning the correct result.

sunny_talwar

Mark, I get that you are not getting what you are looking to get, but I think you are not letting us know what you want? I straight forwardly asked of ~8265 is the number you are looking get, but you ignored to answer that and yet again mentioned that you aren't getting what you wanted. I won't be able to help if you ignore to answer my questions and keep on repeating the same thing over and over my friend.

rittermd
Master
Master
Author

Let's say that I have 3 rows of data.

The processing time is 100, 150, 50 for each of those rows (This is in minutes).

I expect the total to be 300 minutes.  Not something like I am seeing now which is some small fraction.

Does that help?  If not, let me know what else I can tell you.  I am stumped.