Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Time Interval Grouping

Hi,

I need to group time interval,

Eg: 06:00:00 to 09:59:59 as Slot A

       10:00:00 to 12:59:59 as Slot B

        13:00:00 to 16:59:59 as Slot C ect..

I took the Hour Range using this

 

Hour([Session Start]) & ':00 - ' & (Hour(Date([Session Start],'hh:mm'))+1) & ':00' as Hour_Range

0:00 - 1:00

1:00 - 2:00

2:00 - 3:00

4:00 - 5:00

5:00 - 6:00

6:00 - 7:00

7:00 - 8:00

8:00 - 9:00

9:00 - 10:00

10:00 - 11:00

11:00 - 12:00

12:00 - 13:00

13:00 - 14:00

14:00 - 15:00

15:00 - 16:00

16:00 - 17:00

17:00 - 18:00

18:00 - 19:00

19:00 - 20:00

20:00 - 21:00

21:00 - 22:00

22:00 - 23:00

23:00 - 24:00

Now how to group it?

Thanks,

Selva

1 Reply
swuehl
MVP
MVP

Maybe like

if(Hour([Session Start]) >= 6 and hour([Session Start]) < 10, 'Slot A',

     if(Hour([Session Start]) >= 10 and hour([Session Start]) < 13, 'Slot B',

          if(Hour([Session Start]) >= 13 and hour([Session Start]) < 17, 'Slot C'))) as TimeSlots

If your slots span the full day, you can simplify the conditions a bit (start with the smallest slot and only check the upper limit).

Hope this helps,

Stefan