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

Announcements
Register by January 31 for $300 off your Qlik Connect pass: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

mean time between date & time

hi,

i need to calculte rest  time .

this time is calculte with 3 feilds:

1. date

2. in - start time

3. out - end time

i need to calculte the time between date & out and date & in

exm:

dateinoutrest time
01/03/1608:0017:00
02/03/1609:0016:0016:00
04/03/1608:0021:0040:00
05/03/1605:0014:0008:00

hope it's understood.

thanks'

yarin.

5 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Can you explain how did you got rest values.

What is the logic.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
tresB
Champion III
Champion III

Try this:

Load

  *,

  Interval(Date#(date&in,'DD/MM/YYhh:mm')-Date#(Previous(date)&Previous(out),'DD/MM/YYhh:mm'),'hh:mm') as CalculatedrestTime;

LOAD date,

     in,

     out,

     [rest time]

FROM

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

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

Untitled.png

Anonymous
Not applicable
Author

hi,

i'm geting closer ... but i get previos date not o.k.

mybe i need to sort the table at script by date ?

how do i do this ?

tresB
Champion III
Champion III

Load * From <> Order By Date;        

? May be.

sunny_talwar

You can do something like this (Using tresesco‌ code)

Table:

LOAD date,

    in,

    out,

    [rest time]

FROM

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

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


NewTable:

LOAD *,

  Interval(Date#(date&in,'DD/MM/YYhh:mm')-Date#(Previous(date)&Previous(out),'DD/MM/YYhh:mm'),'hh:mm') as CalculatedrestTime

Resident Table

Order By date;


DROP Table Table;