1 Reply Latest reply: Aug 28, 2012 1:14 PM by Jose Tos RSS

    Difference between two timestamps

      Hi,

       

      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.

       

      Regards,

       

      Jon Ditchfield

        • Re: Difference between two timestamps
          Jose Tos

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

           

          TABLE:

          Load *,

          closedate - logdate as Duration;

          select  callref,

                              priority,

                              owner,

                              cust_name,

                              logdate,

                              assigndate,

                              closedby,

                              closedate,

                              probcode,

                              fixcode,

                              respondby,

                              fixby,

                              withinresp,

                              withinfix,

                              completeby,

                              compltdate,

                              lastactdate,

                              lastactby,

                              prob_text,

                              last_text

           

          from opencall

           

          where suppgroup IN ('FINANCIAL SYSTEMS','BUSINESS DEVELOPER');