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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Sum within a group

Hi,

I am having hard time computing difference in time for each "Key" within each day. Can someone please suggest how to do this in QlikView? I can do this Excel and Matlab. I am not an expert, but fairly familiar with Expressions and programming in Qlik. I have the following data and we want to compute:

1. Duration = the difference between "Complete Time" minus "Start" time for each "Key within the same "Date"

2. Then sum those "Duration" for each "Key" only within each day

3. Find percentage of total duration each key took across all keys within the same day. Duration of each key divided by (Minimum(Start) time across any key - Max (Complete) time across any key for the same day.

So from below sample, we want answers to be:

On date 6-26-2013, the total duration for Key 5 will be "25 minutes" + "1 minute" = "26 minutes".

Column

- N is a unique number

- Key is identifier

- Date

- Start is starting date and time

- Complete is complete date and time

NKeyDateStartComplete
1116/26/2013 0:006/26/2013 19:066/26/2013 19:06
1216/26/2013 0:006/26/2013 19:076/26/2013 19:33
1326/26/2013 0:006/26/2013 19:086/26/2013 19:34
1436/26/2013 0:006/26/2013 19:056/26/2013 19:31
1546/26/2013 0:006/26/2013 19:056/26/2013 19:30
1656/26/2013 0:006/26/2013 19:116/26/2013 19:36
1756/26/2013 0:006/26/2013 19:096/26/2013 19:10
1816/27/2013 0:006/27/2013 8:556/27/2013 8:55
1916/27/2013 0:006/27/2013 9:186/27/2013 9:43
2026/27/2013 0:006/27/2013 8:286/27/2013 8:28
2126/27/2013 0:006/27/2013 8:496/27/2013 9:14
2276/27/2013 0:006/27/2013 9:146/27/2013 9:39
2316/28/2013 0:006/28/2013 9:056/28/2013 9:30
2416/28/2013 0:006/28/2013 11:146/28/2013 11:39
2526/28/2013 0:006/28/2013 8:546/28/2013 9:19
2636/28/2013 0:006/28/2013 9:346/28/2013 9:59
2736/28/2013 0:006/28/2013 11:276/28/2013 11:52
2846/28/2013 0:006/28/2013 10:116/28/2013 10:36
2976/28/2013 0:006/28/2013 11:256/28/2013 11:50

Thanks,

10 Replies
Not applicable
Author

Hi Petter,

Thank you for the answer. It finally worked. It did not work initially. After the suggestion by "Nannyogg" I changed the SET TimestampFormat, and then it worked. QlikView is very very sensitive to Date and Time format. You struggle a lot to fix minor formatting changes before you see the results. As far as programming is concerned, Excel and Matlab are extremely easy to program compared to QlikView. But QlikView has tons of nice features

Thanks again for your quick response.

Raghu