<?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: Calculate Working Hour Interval Between Two Dates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440591#M698708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you looked into the other solutions discussed not using the JOIN approach? They should return the number wanted for weekends.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2013 22:28:37 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2013-07-10T22:28:37Z</dc:date>
    <item>
      <title>Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440583#M698700</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 am trying to calculate the working hour interval between two dates (close date and open date).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The requirement is to exclude Thursday and Friday (as weekends) from the duration and working hours should be&lt;/P&gt;&lt;P&gt;7.30 AM to 6.00 PM. The interval should be calculated duration only for business hours and therefore also excluding weekends.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did calculate this in the script but the interval value seems to be more than a couple of hours against the desired value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could somebody please tell me where I'm going wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the attached files for a sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &amp;amp; Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Khaled.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 14:08:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440583#M698700</guid>
      <dc:creator />
      <dc:date>2013-02-15T14:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440584#M698701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please check&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/252929#252929" style="color: #007fc0; text-decoration: initial;"&gt;http://community.qlik.com/message/252929#252929&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/272111#272111" style="color: #007fc0; text-decoration: initial;"&gt;http://community.qlik.com/message/272111#272111&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Hope this helps,&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 15:34:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440584#M698701</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-02-15T15:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440585#M698702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your response. I have already used yours posts as reference to get the solution, and it almost works fine. But I am a little perplexed to see that the interval is still not exactly as desired (or maybe I'm missing something here since there is difference of a few hours between the actual and the desired interval)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since, you coined this solution, could you kindly take a look at the attached sample to see what's missing/wrong with the code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would appreciate your cooperation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Khaled.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 17:46:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440585#M698702</guid>
      <dc:creator />
      <dc:date>2013-02-15T17:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440586#M698703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Khaled,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first, please check the string format codes for date and time, MM is denoting month, not minute, so you must use something like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timestamp(close_date,'MM/DD/YYYY&lt;STRONG&gt; hh:mm:ss&lt;/STRONG&gt;') as close_date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timestamp(open_date,'MM/DD/YYYY&lt;STRONG&gt; hh:mm:ss&lt;/STRONG&gt;') as open_date,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to get a proper time part (it's confusing to see the month as minutes in your sample app ;-).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your time diiference is caused by your custom weekend (Thu &amp;amp; Fri) limitation, you need to use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;where (WeekDay(Date)&amp;lt;&amp;gt;&lt;STRONG&gt;3 &lt;/STRONG&gt;and WeekDay(Date)&amp;lt;&amp;gt;&lt;STRONG&gt;4&lt;/STRONG&gt;) and not match(Date,$(vHol))&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the WeekDay() function, which is returning a number in the range from 0 (Mon) to 6 (Sun).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using above changed where clause, I get 23:02:24 for your sample (the time worked on Sat is appr. 5, not 6 hours).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 18:37:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440586#M698703</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-02-15T18:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440587#M698704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indeed, it's confusing and too silly I did that. Such a bloomer .&lt;/P&gt;&lt;P&gt;Thankyou for all the corrections &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks again.....Stay awesome &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Khaled.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 21:42:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440587#M698704</guid>
      <dc:creator />
      <dc:date>2013-02-15T21:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440588#M698705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Question - did something similar, but now when the date is not a working day, the duration isn't being calculated at all. I'd rather that if the days are weekends that the duration simply say 00, but have a value. how do i accomplish this? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 20:01:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440588#M698705</guid>
      <dc:creator />
      <dc:date>2013-07-10T20:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440589#M698706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which of the discussed expressions are you using (if possible post a small sample file)? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you checked that you are &lt;EM&gt;not &lt;/EM&gt;using a chart with 'suppress zero values' enabled in presentation tab?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 22:12:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440589#M698706</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-07-10T22:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440590#M698707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I essentially have the exact same setup as the original post. Bulk of relevant script below. However, because the left join has a where weekday(date)&amp;lt;5, if the date is a weekend, the left join results in a blank value for that row. So ultimately i would like to be able to modify this such that the working hours and days are set within the initial TMP table such that for day 5 &amp;amp; 6 working hourse are 00:00:00 - 00:00:00. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join (jira_issue)&lt;/P&gt;&lt;P&gt;load %KEY_ISSUE&lt;/P&gt;&lt;P&gt;, priority_set_date&lt;/P&gt;&lt;P&gt;, priority_name&lt;/P&gt;&lt;P&gt;resident issue_priority ; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/// set variable for holidays &lt;/P&gt;&lt;P&gt;set vHol = '41459,41094'; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TMP:&lt;/P&gt;&lt;P&gt;LOAD&amp;nbsp; %KEY_ISSUE,&lt;/P&gt;&lt;P&gt;daystart(priority_set_date)+iterno()-1 as Date,&lt;/P&gt;&lt;P&gt;if(iterno()=1, rangemin(rangemax(frac(priority_set_date),maketime(8)),maketime(18)), maketime(8)) as Start,&lt;/P&gt;&lt;P&gt;if(daystart(priority_set_date)+iterno()-1=daystart(closed_datetime), rangemax(maketime(8),rangemin(frac(closed_datetime),maketime(18))),Maketime(18)) as End&lt;/P&gt;&lt;P&gt;Resident jira_issue&lt;/P&gt;&lt;P&gt;while daystart(closed_datetime) &amp;gt;= daystart(priority_set_date)+iterno()-1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;left join (jira_issue)&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;%KEY_ISSUE,&lt;/P&gt;&lt;P&gt;interval(sum(End-Start), 'hh:mm:ss') as Priority_duration&lt;/P&gt;&lt;P&gt;Resident TMP&amp;nbsp; where WeekDay(Date)&amp;lt;5 and not match(Date,$(vHol))&amp;nbsp;&amp;nbsp; group by %KEY_ISSUE;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table TMP;&lt;/P&gt;&lt;P&gt;drop table issue_priority; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 22:25:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440590#M698707</guid>
      <dc:creator />
      <dc:date>2013-07-10T22:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hour Interval Between Two Dates</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440591#M698708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you looked into the other solutions discussed not using the JOIN approach? They should return the number wanted for weekends.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 22:28:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-Working-Hour-Interval-Between-Two-Dates/m-p/440591#M698708</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-07-10T22:28:37Z</dc:date>
    </item>
  </channel>
</rss>

