<?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: difference between 2 dates in office hours in Data Quality</title>
    <link>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542758#M4372</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/285921"&gt;@NLPTA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this formula, in my end seems to work fine:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;Interval(&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;I&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;f(Hour(responseDate) - 9 &amp;gt;0, responseDate, Floor(TIME_Creation) + MakeTime(17,00)) &lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;- &lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;If(17 - Hour(TIME_Creation) &amp;gt; 0, TIME_Creation, Floor(responseDate) + MakeTime(9,00))&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;+&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;NetWorkDays(TIME_Creation,responseDate)-2&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;, 'hh:mm')&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Wed, 11 Feb 2026 11:05:39 GMT</pubDate>
    <dc:creator>Daniel_Castella</dc:creator>
    <dc:date>2026-02-11T11:05:39Z</dc:date>
    <item>
      <title>difference between 2 dates in office hours</title>
      <link>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542659#M4371</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i know there are alot of topics already but i can not get it to work, not even with the help of my friend copilot...&lt;BR /&gt;&lt;BR /&gt;The formula will only show the difference in hours if both dates are in office time/day/&lt;BR /&gt;What should i change to have it count 1 of them? please help.&lt;BR /&gt;Example Creation_date is 05/01/2026 14:59&amp;nbsp;and Response_date is 05/01/2026 15:18with a perfect result of 00:19 response time.&lt;BR /&gt;Now creation_date&amp;nbsp;13/11/2025 15:46 and response_date&amp;nbsp;14/11/2025 7:29 is a result - and should be 01:14 becasue of office times 09:00-17:00&lt;BR /&gt;&lt;BR /&gt;My formula:&lt;BR /&gt;&lt;BR /&gt;Interval(&lt;BR /&gt;Avg(&lt;BR /&gt;If(&lt;BR /&gt;Hour(Timestamp(responseDate+1/24)) &amp;gt;= 9 AND Hour(Timestamp(responseDate+1/24)) &amp;lt; 17 AND&lt;BR /&gt;Hour(Timestamp(TIME_Creation+1/24)) &amp;gt;= 9 AND Hour(Timestamp(TIME_Creation+1/24)) &amp;lt; 17 AND&lt;BR /&gt;Match(WeekDay(Timestamp(TIME_Creation+1/24)), 'Mon','Tue','Wed','Thu','Fri') AND&lt;BR /&gt;Match(WeekDay(Timestamp(responseDate+1/24)), 'Mon','Tue','Wed','Thu','Fri'),&lt;BR /&gt;(Timestamp(responseDate+1/24) - Timestamp(TIME_Creation+1/24))&lt;BR /&gt;)&lt;BR /&gt;),&lt;BR /&gt;'hh:mm'&lt;BR /&gt;)&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2026 14:59:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542659#M4371</guid>
      <dc:creator>NLPTA</dc:creator>
      <dc:date>2026-02-10T14:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: difference between 2 dates in office hours</title>
      <link>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542758#M4372</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/285921"&gt;@NLPTA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this formula, in my end seems to work fine:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;Interval(&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;I&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;f(Hour(responseDate) - 9 &amp;gt;0, responseDate, Floor(TIME_Creation) + MakeTime(17,00)) &lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;- &lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;If(17 - Hour(TIME_Creation) &amp;gt; 0, TIME_Creation, Floor(responseDate) + MakeTime(9,00))&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;+&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;NetWorkDays(TIME_Creation,responseDate)-2&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;&lt;EM&gt;&lt;FONT size="2"&gt;, 'hh:mm')&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 11:05:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542758#M4372</guid>
      <dc:creator>Daniel_Castella</dc:creator>
      <dc:date>2026-02-11T11:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: difference between 2 dates in office hours</title>
      <link>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542768#M4373</link>
      <description>&lt;P&gt;Thank you Daniel for helping out.&amp;nbsp;&lt;BR /&gt;The results are showing negatives also now and not there yet.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NLPTA_0-1770812034710.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/186837i7F061DB350CB0220/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NLPTA_0-1770812034710.png" alt="NLPTA_0-1770812034710.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 12:14:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542768#M4373</guid>
      <dc:creator>NLPTA</dc:creator>
      <dc:date>2026-02-11T12:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: difference between 2 dates in office hours</title>
      <link>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542775#M4374</link>
      <description>&lt;P&gt;I wouldn't go with such approach else using appropriate prepared table-data within a mapping. Such table might be created manually in Excel but there are also generic possibilities, for example:&lt;/P&gt;&lt;P&gt;load *, Weekday &amp;amp; '|' &amp;amp; Time as Key, rowno() as Value;&lt;BR /&gt;load *, maketime(Hour, Minute) as Time;&lt;BR /&gt;load *, -1 + iterno() as Minute while -1 + iterno() &amp;lt;= 59;&lt;BR /&gt;load *, 8 + iterno() as Hour while 8 + iterno() &amp;lt; 17;&lt;BR /&gt;load pick(recno(), 'Mon', 'Tue', 'Wed', Thu', 'Fri') as Weekday autogenerate 5;&lt;/P&gt;&lt;P&gt;whereby only Key + Value are in the mapping and then a call like:&lt;/P&gt;&lt;P&gt;time(1/24/60 *&lt;BR /&gt;&amp;nbsp; &amp;nbsp;applymap('mapTab',&amp;nbsp;Weekday &amp;amp; '|' &amp;amp; EndTime, null()) -&lt;BR /&gt;&amp;nbsp; &amp;nbsp;applymap('mapTab',&amp;nbsp;Weekday &amp;amp; '|' &amp;amp; StartTime, null())) as Difference&lt;/P&gt;&lt;P&gt;returns the differences.&lt;/P&gt;&lt;P&gt;It's a very simplified example to show the general approach to calculate the differences between timestamps&amp;nbsp; and may need some further adjustments, for example to possible times before or after the office-hours which might be fetched with rangemin/rangemax-queries.&lt;/P&gt;&lt;P&gt;The real benefits of such logic comes when there are different office-times for departments, employees, times and/or holidays&amp;nbsp;and/or breaks needed to be considered or similar stuff. Extending for it the table-data is not mandatory trivial but compared with the nightmare to get a solution with n nested if-loops it would be quite easy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 13:27:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542775#M4374</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2026-02-11T13:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: difference between 2 dates in office hours</title>
      <link>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542777#M4375</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/285921"&gt;@NLPTA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, true. My bad. I needed to adjust a couple of things in my formula. Check the following one, I set the if to take into account the 0 too, and applied a correction factor to the Net Work Days, since they were counted as 24 hours instead of 8 hours.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;Interval(&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;If(Hour(responseDate) - 9 &amp;gt;=0, responseDate, Floor(TIME_Creation) + MakeTime(17,00)) &lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;- &lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;If(17 - Hour(TIME_Creation) &amp;gt; 0, TIME_Creation, Floor(responseDate) + MakeTime(9,00))&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;+ &lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;((NetWorkDays(TIME_Creation,responseDate)-2) * 8/24)&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;, 'hh:mm')&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if now it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 13:35:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542777#M4375</guid>
      <dc:creator>Daniel_Castella</dc:creator>
      <dc:date>2026-02-11T13:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: difference between 2 dates in office hours</title>
      <link>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542789#M4376</link>
      <description>&lt;P&gt;results for the adjusted formula:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NLPTA_0-1770818380658.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/186840i3343C56D561BC60B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NLPTA_0-1770818380658.png" alt="NLPTA_0-1770818380658.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 14:00:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542789#M4376</guid>
      <dc:creator>NLPTA</dc:creator>
      <dc:date>2026-02-11T14:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: difference between 2 dates in office hours</title>
      <link>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542798#M4377</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/285921"&gt;@NLPTA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ok, I have changed the formula concept. I tested most of the points of your table (before I only did a couple) and now it seems to work.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;Interval(&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;If(Hour(responseDate) - 9 &amp;lt; 0, Rangemax(MakeTime(Hour(responseDate), Minute(responseDate)), MakeTime(9,00)), Rangemin(MakeTime(Hour(responseDate), Minute(responseDate)), MakeTime(17,00)))&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;- &lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;If(Hour(TIME_Creation) - 9 &amp;lt; 0, Rangemax(MakeTime(Hour(TIME_Creation), Minute(TIME_Creation)), MakeTime(9,00)), Rangemin(MakeTime(Hour(TIME_Creation), Minute(TIME_Creation)), MakeTime(17,00)))&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;+ (Rangemax((NetWorkDays(TIME_Creation,responseDate)-1),0) * 8/24)&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;,'hh:mm')&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 14:45:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Data-Quality/difference-between-2-dates-in-office-hours/m-p/2542798#M4377</guid>
      <dc:creator>Daniel_Castella</dc:creator>
      <dc:date>2026-02-11T14:45:25Z</dc:date>
    </item>
  </channel>
</rss>

