Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Time subtraction

Hello All,

We need to achieve the following output :

184:37:40 - 00:00:00 = 184:37:40

The above data set is basically a time value captured in terms of 'hh:mm:ss'. We need to calculate the difference between the two time values. How can this be achieved in qlikview?

Thanks and regards,

Erwin

1 Reply
Anonymous
Not applicable
Author

Hi there,

first of all you need to go to the data load editor where your dates are (this is not compulsory, it just depends how Qlik is reading in the dates).

Go to the dates and use the Timestamp#() function

e.g.

Load

Timestamp#(timeOne, 'hh:mm:ss') as timeOne,

Timestamp#(timeTwo, 'hh:mm:ss') as timeTwo

From blablabla;

Then your calculation would be:

Interval(timeOne - timeTwo, 'hh:mm:ss')


you can also skip the data load editor step and still do this if the format is already a time and not a string. Or you can still skip it and do this:

Interval(Timestamp#(timeOne, 'hh:mm:ss') - Timestamp#(timeTwo, 'hh:mm:ss'), 'hh:mm:ss')



hope this helps,

Let me know how you get on!