Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vengadeshpalani
Creator
Creator

Half an hour Interval Match Issue

Hi AIl

i have created interval match based on Half an hour

i need the result like if Start Hour =13:00 and End Hour = 16:00 means i want to set Event Hour flag for 13:00, 13:30, 14:00,14:30,15:00,15:30 but in below image, it considered 16:00 also Event Hour

Screenshot_1.png

if Start Hour =14:00 and End Hour = 17:00 means i want to set Event Hour flag for 14:00,14:30,15:00,15:30,16:00,16:30

but in below image, it start from 14:30 to 17:00

Screenshot_2.png

1 Solution

Accepted Solutions
sunny_talwar

Try this

1:

LOAD * INLINE [

    EventDate, StartHour, EndHour

    8/30/2017, 14:00, 17:00

    9/15/2017, 13:00, 16:00

    9/22/2017, 13:00, 16:00

];


NoConcatenate

2:

load Date(EventDate,'MM/DD/YYYY') as EventDate,

Time(Time#(StartHour,'hh:mm')-MakeTime(0,0,1),'hh:mm') as StartHour,

    Time(Time#(EndHour,'hh:mm')+MakeTime(0,0,1),'hh:mm')  as EndHour

Resident 1; DROP Table 1;


JOIN(2)

LOAD

Time(Time#('09:00','hh:mm') + ((RowNo()-1)/48),'hh:mm') AS Hour

AUTOGENERATE(20)

;


IntervalMatch:

IntervalMatch(Hour)

LOAD

StartHour,

    EndHour

RESIDENT 2;


JOIN(2)

LOAD *, Num(1) as EventHour

Resident IntervalMatch; DROP Table IntervalMatch; 

View solution in original post

2 Replies
sunny_talwar

Try this

1:

LOAD * INLINE [

    EventDate, StartHour, EndHour

    8/30/2017, 14:00, 17:00

    9/15/2017, 13:00, 16:00

    9/22/2017, 13:00, 16:00

];


NoConcatenate

2:

load Date(EventDate,'MM/DD/YYYY') as EventDate,

Time(Time#(StartHour,'hh:mm')-MakeTime(0,0,1),'hh:mm') as StartHour,

    Time(Time#(EndHour,'hh:mm')+MakeTime(0,0,1),'hh:mm')  as EndHour

Resident 1; DROP Table 1;


JOIN(2)

LOAD

Time(Time#('09:00','hh:mm') + ((RowNo()-1)/48),'hh:mm') AS Hour

AUTOGENERATE(20)

;


IntervalMatch:

IntervalMatch(Hour)

LOAD

StartHour,

    EndHour

RESIDENT 2;


JOIN(2)

LOAD *, Num(1) as EventHour

Resident IntervalMatch; DROP Table IntervalMatch; 

prat1507
Specialist
Specialist

Hi

Please see the sample app.

It is working fine for me.


Regards

Pratyush