Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Difference between two timestamps


I was wondering if someone would be able to help me as Im new to Qlikview.

Thanks to swuehl who wrote the attached code, I am able to put sample data into Qlikview and output it into tables.  The code basically take two separate dates/times eg: 01/08/2012 09:00:00 - 01/08/2012 10:00:00 and it works out the difference in hh:mm:ss and puts it into a table called Duration. 

It also ensures that the duration is not calculated for weekends and also if the time is before 08:00 and after 18:00.

The problem is, I have no idea how to amend the sample data and put it into the 'Live Data'

I will have two fields, one called logdate and the other called closedate.  What I want is the attached code to be amended so the field called duration basically calculates the closedate minus the logdate.  I want to then be able to pull Duration field into a Straight chart.


Jon Ditchfield

1 Reply
Valued Contributor II

Re: Difference between two timestamps

If the types are the same for closedate and logdate you could use closedate-logdate.


Load *,

closedate - logdate as Duration;

select  callref,





















from opencall


Community Browser