Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
syed
Contributor
Contributor

interval function giving negative results

Dear qlikview experts

Iam struck with one issue

shiftid       shift in time  shift out time

         1        06:00:00       15:00:00

          2       09:00:00        18:00:00

          3       12:00:00         21:00:00

          4     15:00:00         00:00:00

when iam using interval function like interval(shift out time-shift in time ) i am getting total working hours for all shifts but for

shiftid 4 iam getting values in negative like -15:00:00. will any one please look in to this where Iam doing wrong.

Thanks

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Shiftid 4 starts at 15:00:00 and finishes at 00:00:00 (value 0), so you need something more to calculate these times. If they are always less than 24 hours, this will work

     Interval(If([shift out time] > [shift in time], [shift out time] - [shift in time], 1 + [shift out time] - [shift in time]))

The '1' adds 1 day (24 hours) to the interval.

If they could be more than 24 hours, you will need start and end dates as well.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Shiftid 4 starts at 15:00:00 and finishes at 00:00:00 (value 0), so you need something more to calculate these times. If they are always less than 24 hours, this will work

     Interval(If([shift out time] > [shift in time], [shift out time] - [shift in time], 1 + [shift out time] - [shift in time]))

The '1' adds 1 day (24 hours) to the interval.

If they could be more than 24 hours, you will need start and end dates as well.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
syed
Contributor
Contributor
Author

Perefect John Its working now. Thanks alot