Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

jpapador
Valued Contributor

Create intervals between a range

I have a start time and a stop time what I'd like to do is create records for every hour in between.

For example:

Current:

Record NumStart TimeStop Time
110:0013:27

What I want

Record Num

Hour interval
110:00
111:00
112:00
1

13:00

113:27
1 Solution

Accepted Solutions
MVP
MVP

Re: Create intervals between a range

X:

LOAD

  [Record Num],

    [Start Time],

    [Stop Time],

  Time([Start Time] + 1/24 * (iterno()-1)) as Hour

FROM

[https://community.qlik.com/thread/240846]

(html, codepage is 1252, embedded labels, table is @1)

While [Start Time] + 1/24 * (iterno()-1) <=  [Stop Time]

;

Concatenate (X)

X:

First 1

LOAD

  [Record Num],

    [Start Time],

    [Stop Time],

  0+[Stop Time] as Hour

FROM

[https://community.qlik.com/thread/240846]

(html, codepage is 1252, embedded labels, table is @1)

;

2 Replies
MVP
MVP

Re: Create intervals between a range

May be try this:

Table:

LOAD [Record Num],

  Time(RangeMin(Round([Start Time] - MakeTime(1) + MakeTime(IterNo()), 1/24), [Stop Time])) as [Hour Interval]

While Round([Start Time] - MakeTime(1) + MakeTime(IterNo()), 1/24) < [Stop Time] + MakeTime(1);

LOAD * INLINE [

    Record Num, Start Time, Stop Time

    1, 10:00, 13:27

];

MVP
MVP

Re: Create intervals between a range

X:

LOAD

  [Record Num],

    [Start Time],

    [Stop Time],

  Time([Start Time] + 1/24 * (iterno()-1)) as Hour

FROM

[https://community.qlik.com/thread/240846]

(html, codepage is 1252, embedded labels, table is @1)

While [Start Time] + 1/24 * (iterno()-1) <=  [Stop Time]

;

Concatenate (X)

X:

First 1

LOAD

  [Record Num],

    [Start Time],

    [Stop Time],

  0+[Stop Time] as Hour

FROM

[https://community.qlik.com/thread/240846]

(html, codepage is 1252, embedded labels, table is @1)

;