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 create shifts form a date field

Dears.

I want to make a bar chart that could show how many tickets per shift are created, I have a field call "Ticket Creation Date" where appears information like this "2016-04-21 10:00". I have in my operation 3 shifts 6am to 2pm, 2pm to 10 pm and 10pm to 6 am, my idea is identify how many tickets are created in the different shifts.

Someone can help me?

Thanks in advance.

1 Solution

Accepted Solutions
sunny_talwar

Check this:

LOAD [Ticket #],

    [Ticket creation Date],

    Creator,

    If(Frac([Ticket creation Date]) > MakeTime(22) or Frac([Ticket creation Date]) <= MakeTime(6), 3,

    If(Frac([Ticket creation Date]) > MakeTime(14), 2, 1)) as Shift

FROM

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

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


Capture.PNG

View solution in original post

4 Replies
sunny_talwar

Would you be able to share some sample data to help you with this?

Not applicable
Author

Dear Sunny:

The Data is something like this:

   

Ticket #Ticket creation DateCreator
IM0014/22/2016 6:10User1
IM0024/22/2016 13:55User2
IM0034/22/2016 15:55User3
IM0044/22/2016 19:23User1
IM0054/22/2016 20:30User1
IM0064/22/2016 22:40User3
IM0074/23/2016 1:55User6
IM0084/23/2016 4:55User4
IM0094/23/2016 7:55User1

The Daily shifts are 3

1. From 06:01 to 14:00

2. From 14:01 to 22:00

3. From 22:01 to 06:00

From this information I want to calculate how many tickets were created in the range of time of every shift, in resume I want to calculate how many tickets were created between 6:01 am until 2 pm,  and so on.

From the table at the beginning we can obtain that 3 Tickets were created in the shift from 6am to 2pm, Ticket # IM001, IM002 and IM009.

From the range (Shift) from 2pm until 10pm were created 3 Tickets, Ticket # IM003, IM004, IM005.

From the range (Shift) from 10pm until 6am were created 3 Tickets, Ticket # IM006, IM007, IM008.

BR

sunny_talwar

Check this:

LOAD [Ticket #],

    [Ticket creation Date],

    Creator,

    If(Frac([Ticket creation Date]) > MakeTime(22) or Frac([Ticket creation Date]) <= MakeTime(6), 3,

    If(Frac([Ticket creation Date]) > MakeTime(14), 2, 1)) as Shift

FROM

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

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


Capture.PNG

Not applicable
Author

Great Help, Thanks