Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
microwin88x
Creator III
Creator III

Range Days

Hello,

I have the following table

TICKETCREATE_DATECREATE_TIMECLOSE_DATECLOSE_TIMEDURATION
ID107/06/201613:22:3009/06/201616:10:2602 02:47:56
ID207/06/201613:12:4807/06/201614:22:2800 01:09:40
ID407/06/201613:21:1714/06/201610:36:3006 21:15:13
ID508/06/20169:05:4224/06/201613:10:2116 04:04:39
ID608/06/20169:30:4608/06/20169:40:1400 00:09:28


What I need is to use the field DURATION (DD hh:mm:ss) to create a new field RANGE_DAYS to know if the ID corresponds to:

  • <=1 day
  • 2-7 days
  • 8-14 days
  • >= 15 days

Then I'd have something like the following:

       

TICKETCREATE_DATECREATE_TIMECLOSE_DATECLOSE_TIMEDURATIONRANGE
ID107/06/201613:22:3009/06/201616:10:2602 02:47:562-7 days
ID207/06/201613:12:4807/06/201614:22:2800 01:09:40<=1 day
ID407/06/201613:21:1714/06/201610:36:3006 21:15:132-7 days
ID508/06/20169:05:4224/06/201613:10:2116 04:04:39>=15 days
ID608/06/20169:30:4608/06/20169:40:1400 00:09:28<=1 day

Do you know how to get this?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Table:

LOAD *,

  If(DURATION <= 1, Dual('<=1 day', 1),

     If(DURATION <= 7, Dual('2-7 days', 2),

     If(DURATION <= 14, Dual('8-14 days', 3), Dual('>= 15 days', 4)))) as RANGE;

LOAD TICKET,

     CREATE_DATE,

     CREATE_TIME,

     CLOSE_DATE,

     CLOSE_TIME,

     Interval(CLOSE_DATE + CLOSE_TIME - CREATE_DATE - CREATE_TIME, 'D hh:mm:ss') as DURATION

FROM

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

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

View solution in original post

3 Replies
sunny_talwar

May be this:

Table:

LOAD *,

  If(DURATION <= 1, Dual('<=1 day', 1),

     If(DURATION <= 7, Dual('2-7 days', 2),

     If(DURATION <= 14, Dual('8-14 days', 3), Dual('>= 15 days', 4)))) as RANGE;

LOAD TICKET,

     CREATE_DATE,

     CREATE_TIME,

     CLOSE_DATE,

     CLOSE_TIME,

     Interval(CLOSE_DATE + CLOSE_TIME - CREATE_DATE - CREATE_TIME, 'D hh:mm:ss') as DURATION

FROM

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

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

vishsaggi
Champion III
Champion III

I am not sure if this is the good way of doing it but just tried please check this ?

Dimensions: All your fields

Expression:

= IF(LEFT(DURATION,2) <= 1, '<=1Day',

  IF(Left(DURATION,2) <= 7, '2-7Days',

  IF(Left(DURATION,2) > 7, '>=15Days')))

vishsaggi
Champion III
Champion III

Oops I missed that 7-14 days. Superb Sunny.