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

IntervalMatch to assign a Time Period label to Event Times

Hi

I have a table with a series of 'Events', each of which has a time.  

this is the format of the original tablethis is the format of the original table

I'm trying to assign a 'time period' to each row, eg

Capture2.PNG

I'm hoping to end up with a table like the below: 

Capture3.PNG

 

I've been trying to use IntervalMatch to achieve this, but for some reason my results are as follows:

Capture4.PNG

 

The script I am using is as follows

Time:
LOAD time#(Start_Time,'hh:mm:ss:fff') as Start_Time,
time#(End_Time,'hh:mm:ss:fff') as End_Time,
Time_Period_Group
FROM
[C:\Users\Time_Periods.xlsx]
(ooxml, embedded labels, table is Sheet1);

 

Main_Table:

LOAD Event,
time([Time],'hh:mm:ss:fff')as Time 
FROM
[C:\Users\Events.xlsx]
(ooxml, embedded labels, table is Sheet1);

Inner Join IntervalMatch (Main_Table)
Load time#(Start_Time,'hh:mm:ss:fff') as Start_Time,
time#(End_Time,'hh:mm:ss:fff') as End_Time,
Time_Period_Group
Resident Time;

 

This is my first attempt at using IntervalMatch and no doubt there is some issue with the syntax - any help or advice would be highly appreciated!

 

Many thanks

Labels (2)
1 Reply
Brett_Bleess
Former Employee
Former Employee

Here is a post from Michael Tarallo that might be of some help, it has been a long while since I used this as well, so not sure I am going to be much help without really diving in and working things myself, and unfortunately I do not have the time to do that at the moment, so hopefully the following may help if you are still struggling:

https://community.qlik.com/t5/Qlik-Design-Blog/Using-IntervalMatch/ba-p/1475510

And here is post from Henric Cronstrom as well:

https://community.qlik.com/t5/Qlik-Design-Blog/IntervalMatch/ba-p/1464547

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.