Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Hours between two dates- LoadInLine (newbee), does not work

Hello Qlikview experts,

I'm trying newly to calculate simple difference between two dates in hours. I have tried to implement whats already discussed here but something does not work. What am I doing wrong? I'm new time strings. Thanks for help. I'm attaching data also -maybe there is wrong format?

My script is here:


[tab1]:
 
LOAD
 
Interval( Modified - Created, 'hh:mm' )  AS [Hours]
  ;

[tab2]:
 
LOAD

*
 
INLINE
 
[
Created, Modified
  '3/20/2018 10:25', '3/20/2018 10:59'
  ]

  ;

LOAD ID,
Created,
Modified,
[Modified By]
FROM

(
ooxml, embedded labels);

1 Solution

Accepted Solutions
bhaskar_sm
Partner - Creator III
Partner - Creator III

Hi,

please find attached the Qvw.

and script

LOAD *,interval(num(Modified) - num(Created),'dd:hh:mm:ss')as  Diff ;

LOAD ID,

    Created,

    Modified

FROM

[data.xlsx]

(ooxml, embedded labels, table is query);

hhh.PNG

View solution in original post

5 Replies
bhaskar_sm
Partner - Creator III
Partner - Creator III

Hi,

please find attached the Qvw.

and script

LOAD *,interval(num(Modified) - num(Created),'dd:hh:mm:ss')as  Diff ;

LOAD ID,

    Created,

    Modified

FROM

[data.xlsx]

(ooxml, embedded labels, table is query);

hhh.PNG

jaumecf23
Creator III
Creator III

Hi,

Qlikview is not able to identify that the fields Created and Modified are Dates. If you inform this to Qlikview then it works as you can see in the follow script:

[tab1]:

  LOAD

  Interval(Date#(Modified,'MM/DD/YYYY HH:mm') - Date#(Created,'MM/DD/YYYY HH:mm'), 'hh:mm' )  AS [Hours]

  ;

[tab2]:

  LOAD

*

  INLINE

  [

Created, Modified

  '3/20/2018 10:25', '3/20/2018 10:59'

  ]

  ;

Anonymous
Not applicable
Author

thank you Bhasker, your solution works perfect!

bhaskar_sm
Partner - Creator III
Partner - Creator III

if your problem is resolved, can you mark it correct to close this ?

Anonymous
Not applicable
Author

Hello Bhasker and all, after implementing the solution I received another challenge. How can I integrate condition of counting only "working hours" if that means MONDAY-FRIDAY 9AM-6PM?

Can you help me?

Thank you in advance