Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikconsultant
Creator III
Creator III

if statement with timestamps

I have the following data:

TIME_STAMPAtribute A
08.05.2012 10:12:111
08.05.2012 11:01:301
08.05.2012 11:47:162
08.05.2012 16:02:061
08.05.2012 16:32:111
08.05.2012 16:43:541
08.05.2012 17:42:542
08.05.2012 17:43:242
08.05.2012 18:51:471
08.05.2012 19:24:431
08.05.2012 19:54:443
08.05.2012 09:14:004
08.05.2012 09:38:001
08.05.2012 10:09:002
08.05.2012 11:00:572
08.05.2012 12:00:021
08.05.2012 13:01:091
08.05.2012 13:32:441
08.05.2012 14:00:413
08.05.2012 14:35:052

My goal is to get the sum over the next 10 minute of the timestamp.

Example: For 08.05.2012 17:42:54 the result should be 4.

My idea is:

sum(if(TIME_STAMP<=TIME_STAMP+7minute,Atribute A)) as mySum

But I have no idea for the code TIME_STAMP+7. Any ideas?

2 Replies
swuehl
MVP
MVP

Hi Markus,

I created a copy of your TIME_STAMP field in a data island to use as dimension, thus allowing something like

=sum(if( TIME_STAMP >= TIME_STAMP_DIM and TIME_STAMP <= TIME_STAMP_DIM + Interval#(10,'mm') , [Atribute A]))

See attached.

Regards,

Stefan

qlikconsultant
Creator III
Creator III
Author

Hi swuehl,

I implemted your idea in my report but for some that I cant explain i get adition on the last row.

Is there any solution to calculate the value in the skript?