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

Announcements
Qlik Unveils New Agentic Capabilities Across Analytics, Data Engineering, and Trust: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
roisolberg
Creator
Creator

Moving time bucket (example: time now - 2 hours)

Hello everyone,

I need to add to one of my models a counter that will count events in a few time buckets.

in the model i'd like to count closed lines in the system, that was closed in;

last 15 min

last 15 to last 30

30 min to an hour

1-2 hours

the thing is this is a dynamic report and from what i understand the time buckets are fixed hours/days

in a "freestyle " writing i need something like this:

count (ClosedLines) where ClosedLineDate=Today() and ClosedLineTime between Now() and (Now()-2 hours)

Thanks

10 Replies
roisolberg
Creator
Creator
Author

Hi All,

thank you for all your replayes!

this is what i've done:


let vTimeNow=time(Now());


let vlasthour=time(now()-1/24);


let vlast2hours=time(now()-2/24);


let vlastQuarterhour=time(now()-15/1440);


let vlastHALFhour=time(now()-30/1440);


let vlast15min=time(now()-15/1440);




ClosedLines:


load


FOLUPInnerNum,


    LineClosedDate,


    LineClosedTime,


    if(LineClosedDate='$(vToday)' and (LineClosedTime>'$(vlast2hours)' and LineClosedTime<'$(vlasthour)'),1,0) as Last2Hours,


    if(LineClosedDate='$(vToday)' and (LineClosedTime>'$(vlasthour)' and LineClosedTime<'$(vlastHALFhour)'),1,0) as Last1Hour,


    if(LineClosedDate='$(vToday)' and (LineClosedTime>'$(vlastHALFhour)' and LineClosedTime<'$(vlast15min)'),1,0) as Last0.5Hour,


    if(LineClosedDate='$(vToday)' and (LineClosedTime>'$(vlast15min)' and LineClosedTime<'$(vTimeNow)'),1,0) as Last15min



it worked fine after the inital load, but once i run it in production, its not loading continuously


any advice?