<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Require hrs calculation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158824#M377777</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nisha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first problem is the fact that in the Excel file you provided, you have different date formats, which it seems to be causing Qlikview to load the field as text not as a date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So not taking the above issue into consideration and assuming I have a correct list of dates directly from the source table, here is how you can retrieve the amount of hours between two dates:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, if we get the Min and Max date, and we subtract them directly, we will get the number of days between the two dates:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14643539466878607 jive_text_macro" jivemacro_uid="_14643539466878607"&gt;
&lt;P&gt;MAX(EVENTDATE) - MIN(EVENTDATE)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Asuming the Min = 1/31/2016 and Max = 5/26/2016 we get a difference of 116 days.&lt;/P&gt;&lt;P&gt;If we multiply those days by 24 we get the hours: 2784&amp;nbsp; (which I gues is what you are looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a more direct way of doing this by using the INTERVAL expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14643540363554368" jivemacro_uid="_14643540363554368"&gt;
&lt;P&gt;INTERVAL(MAX(EVENTDATE) - MIN(EVENTDATE))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Interval expression will give you the hours, minutes and seconds between the two dates.&amp;nbsp; This works best when using a timestamp, since it will give you the difference in minues and seconds as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached the excel file I used and the example QVW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 May 2016 13:04:15 GMT</pubDate>
    <dc:creator>novolouy</dc:creator>
    <dc:date>2016-05-27T13:04:15Z</dc:date>
    <item>
      <title>Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158820#M377773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two date field .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Get&amp;nbsp; In Date Logic = Min(EVENTDATE)&lt;/P&gt;&lt;P&gt;2. Get&amp;nbsp; Out Date&amp;nbsp; = date(max(GATE_OUT_EVENTDATE),'DD-MM-YYYY')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I require total hours Calculation. i.e (Get&amp;nbsp; Out Date - Get&amp;nbsp; In Date) = Total hrs work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the sample data of event date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly provide solution for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 11:31:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158820#M377773</guid>
      <dc:creator />
      <dc:date>2016-05-27T11:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158821#M377774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Hour(frac(max(GATE_OUT_EVENTDATE)) - frac(&lt;/SPAN&gt;Min(EVENTDATE)))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 11:38:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158821#M377774</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2016-05-27T11:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158822#M377775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nisha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your source having one Date field&amp;nbsp; not two &lt;SPAN style="font-size: 13.3333px;"&gt;Date field &lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mahesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 11:39:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158822#M377775</guid>
      <dc:creator>qlikview979</dc:creator>
      <dc:date>2016-05-27T11:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158823#M377776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Kushal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Hour(frac(max(GATE_OUT_EVENTDATE)) - frac(&lt;/SPAN&gt;Min(EVENTDATE))) does not work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;It shows 0 hrs.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Please check the syntax.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 12:19:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158823#M377776</guid>
      <dc:creator />
      <dc:date>2016-05-27T12:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158824#M377777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nisha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first problem is the fact that in the Excel file you provided, you have different date formats, which it seems to be causing Qlikview to load the field as text not as a date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So not taking the above issue into consideration and assuming I have a correct list of dates directly from the source table, here is how you can retrieve the amount of hours between two dates:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, if we get the Min and Max date, and we subtract them directly, we will get the number of days between the two dates:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14643539466878607 jive_text_macro" jivemacro_uid="_14643539466878607"&gt;
&lt;P&gt;MAX(EVENTDATE) - MIN(EVENTDATE)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Asuming the Min = 1/31/2016 and Max = 5/26/2016 we get a difference of 116 days.&lt;/P&gt;&lt;P&gt;If we multiply those days by 24 we get the hours: 2784&amp;nbsp; (which I gues is what you are looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a more direct way of doing this by using the INTERVAL expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14643540363554368" jivemacro_uid="_14643540363554368"&gt;
&lt;P&gt;INTERVAL(MAX(EVENTDATE) - MIN(EVENTDATE))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Interval expression will give you the hours, minutes and seconds between the two dates.&amp;nbsp; This works best when using a timestamp, since it will give you the difference in minues and seconds as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached the excel file I used and the example QVW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 13:04:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158824#M377777</guid>
      <dc:creator>novolouy</dc:creator>
      <dc:date>2016-05-27T13:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158825#M377778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Need to understand your question more, need more details.&lt;/P&gt;&lt;P&gt;I only see one column of data in your file. and the date format is not consistent too. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 13:32:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158825#M377778</guid>
      <dc:creator>isaaclin</dc:creator>
      <dc:date>2016-05-27T13:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158826#M377779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg : Get Out Date = 29-05-2016 10.16.00 and Get&amp;nbsp; In Date 28-05-2016 08.00.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That means Get in date from 28th May 2016 8.00 AM to 29th May 2016 8.00 Am is 24 hrs and from 8.00am to 10.16.00 total is 34 hrs and 16min .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System should display 34 hrs and 16mins .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you get my issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interval(max(Eventdate)- Interval(min(eventdate)) does not give proper hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please provide the solution on the above issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 May 2016 13:06:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158826#M377779</guid>
      <dc:creator />
      <dc:date>2016-05-30T13:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158827#M377780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nisha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact, the "&lt;SPAN style="color: #3366ff;"&gt;INTERVAL&lt;/SPAN&gt;" function is still what you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So assuming we have the following timestamps:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14646147476602925 jive_text_macro" jivemacro_uid="_14646147476602925" modifiedtitle="true"&gt;
&lt;P&gt;[GET IN DATE] =&amp;nbsp;&amp;nbsp; 5/28/2016 8:00:00 AM&lt;/P&gt;
&lt;P&gt;[GET OUT DATE] =&amp;nbsp; 5/29/2016 10:16:00 PM&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Between those timestamps we get a difference of 38 hours and 16 minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get to that result we still use the INTERVAL function as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14646148308682458 jive_text_macro" jivemacro_uid="_14646148308682458" modifiedtitle="true"&gt;
&lt;P&gt;INTERVAL([GET OUT DATE] - [GET IN DATE], 'hh:mm:ss')&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives us a result of:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;38:16:00&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached the example QVW showing the calculations.&amp;nbsp; (Also attached the excel file I used for this example)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 May 2016 13:29:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158827#M377780</guid>
      <dc:creator>novolouy</dc:creator>
      <dc:date>2016-05-30T13:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Require hrs calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158828#M377781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, below is my test, i only kept two dates in your excel file for testing purpose.&lt;/P&gt;&lt;P&gt;you need to use your date&amp;nbsp; times 24 before subtract &lt;/P&gt;&lt;P&gt;actually I got this idea from excel formula, I used this all the time in excel.&lt;/P&gt;&lt;P&gt;I tested in qlik, and it worked too.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture1.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/126238_Capture1.JPG" style="height: auto;" /&gt;&lt;IMG alt="Capture.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/126237_Capture.JPG" style="height: 324px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 May 2016 13:40:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Require-hrs-calculation/m-p/1158828#M377781</guid>
      <dc:creator>isaaclin</dc:creator>
      <dc:date>2016-05-30T13:40:21Z</dc:date>
    </item>
  </channel>
</rss>

