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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to expand rows based on timestamp with 1 minute intervals

Dear all,

I have a table with field Date_time:

Column Date_time has a timestamp format.

I want to expand the table with 1 minute time interval up to e.g. 2 minutes backward and forward..

It is possible that backward and forward will be done up to 10 or 20 minutes, depending on the circumstances.

Could you demonstrate how to solve in the script?

Best regards,

Cornelis

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe something like this:

LOAD ID,

     Timestamp(Date_time+ (iterno()-3)*(1/(24*60))) as Date_time

FROM

[https://community.qlik.com/servlet/JiveServlet/download/1120647-244677/Datetime%20iteration.xlsx]

(ooxml, embedded labels, table is LOAD)

While Iterno() <= 5

;

ID Date_time
130.08.2016 18:20:00
130.08.2016 18:21:00
130.08.2016 18:22:00
130.08.2016 18:23:00
130.08.2016 18:24:00
202.09.2016 06:57:00
202.09.2016 06:58:00
202.09.2016 06:59:00
202.09.2016 07:00:00
202.09.2016 07:01:00

View solution in original post

2 Replies
swuehl
MVP
MVP

Maybe something like this:

LOAD ID,

     Timestamp(Date_time+ (iterno()-3)*(1/(24*60))) as Date_time

FROM

[https://community.qlik.com/servlet/JiveServlet/download/1120647-244677/Datetime%20iteration.xlsx]

(ooxml, embedded labels, table is LOAD)

While Iterno() <= 5

;

ID Date_time
130.08.2016 18:20:00
130.08.2016 18:21:00
130.08.2016 18:22:00
130.08.2016 18:23:00
130.08.2016 18:24:00
202.09.2016 06:57:00
202.09.2016 06:58:00
202.09.2016 06:59:00
202.09.2016 07:00:00
202.09.2016 07:01:00
Not applicable
Author

Hello Stefan,

Yes, thsi is the solution.

I thought it is something with iterno() funcion like this:

  interval(rangemin(Eind, floor(Start) + IterNo() ) - rangemax(Start,floor(Start) + IterNo() -1),'hh:mm') as Duration
Resident Input2
While floor(Start)+IterNo()-1 <=Eind

but this is based on days and you have solved it with

Timestamp(Date_time+ (iterno()-3)*(1/(24*60)))

Thanks for your quick help

Best regards,

Cornelis