<?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 Adjusting Timestamp to Next Work Day in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370475#M493526</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QV Users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'am having issues with adjusting a timestamp. I have pulling in information on the arrival and completion time for customer emails. I have included a flow chart for the logic. I thought i would type it but the chart is so small and simple that I thought it would be best. I have a hoilday table inlcluded in my script and I hope to use it to skip over company holidays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance would be much appreciated. &lt;/P&gt;&lt;P&gt;&lt;IMG alt="EmailTimestampFlow.png" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/14765_EmailTimestampFlow.png" style="display: block; margin-left: auto; margin-right: auto;" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 May 2012 21:16:33 GMT</pubDate>
    <dc:creator>villegasi03</dc:creator>
    <dc:date>2012-05-25T21:16:33Z</dc:date>
    <item>
      <title>Adjusting Timestamp to Next Work Day</title>
      <link>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370475#M493526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QV Users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'am having issues with adjusting a timestamp. I have pulling in information on the arrival and completion time for customer emails. I have included a flow chart for the logic. I thought i would type it but the chart is so small and simple that I thought it would be best. I have a hoilday table inlcluded in my script and I hope to use it to skip over company holidays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance would be much appreciated. &lt;/P&gt;&lt;P&gt;&lt;IMG alt="EmailTimestampFlow.png" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/14765_EmailTimestampFlow.png" style="display: block; margin-left: auto; margin-right: auto;" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2012 21:16:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370475#M493526</guid>
      <dc:creator>villegasi03</dc:creator>
      <dc:date>2012-05-25T21:16:33Z</dc:date>
    </item>
    <item>
      <title>Adjusting Timestamp to Next Work Day</title>
      <link>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370476#M493527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you should be able to reuse some of the logic I suggested here for a slightly different problem.&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/216532#216532"&gt;http://community.qlik.com/message/216532&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you just need the part that correct the timestamp for the next business day (up to the Tickets table in the referenced example).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case you can't open other's files:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Create Calendar, start with non weekend or holiday&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;TMPCalendar:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;date(makedate(2012)+recno()-2) as Date&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AutoGenerate 201;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// join Holiday calendar&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;left join LOAD * INLINE [&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Date, Holiday&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'01.01.2012', 'New Year'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'04.01.2012', Test&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'06.01.2012', Epiphany&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'06.04.2012', 'Good Friday'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'09.04.2012', 'Easter Monday'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'01.05.2012', '1st of May'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;'17.05.2012', 'Holiday'&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;];&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Create some additional fields (date information and correction used later on)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;TMPCalendar2:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, WeekDay(Date) as Weekday, Month(Date) as Month, Year(Date) as Year;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Load *, rangesum(peek(Add1Day,rowno()-rangesum(Add1Day,1)),1,Add1Day) as Add2Days;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load *, if(weekday(peek(Date))&amp;gt;=5 or not isnull(peek(Holiday)), rangesum(peek(Add1Day),1)) as Add1Day &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident TMPCalendar order by Date desc;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table TMPCalendar;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Create final calendar, calculate correction for ticket creation (to add of creation is a weekend / holiday)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Calendar:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load *, if(Weekday &amp;gt;=5 or not isnull(Holiday), peek(Add1Day)) as CorrectStartDay &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident TMPCalendar2 order by Date asc;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table TMPCalendar2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Create (or - in real setting - load) ticket creation timestamp, correct timestamp to next productive period, part I)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;TMPTickets:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, daystart(TicketCreationCorr) as TicketCreationCorrDate;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, timestamp(if(hour(TicketCreation) &amp;lt; 9, daystart(TicketCreation)+interval#('09:00:00'), if(hour(TicketCreation)&amp;gt;16, daystart(TicketCreation)+1+Interval#('09:00:00'),TicketCreation))) as TicketCreationCorr; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Timestamp(makedate(2012)+RAND()*200) as TicketCreation&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AutoGenerate 1000;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Left join LOAD Date as TicketCreationCorrDate, CorrectStartDay as TicketCorrectStartDay Resident Calendar;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Create final ticket table: Correct timestamp to next productive period (add CorrectStartDay), part II&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Tickets:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, timestamp(rangesum(TicketCreationCorr,TicketCorrectStartDay)) as TicketProductiveStart, date(rangesum(TicketCreationCorrDate,TicketCorrectStartDay)) as TicketProductiveStartDate resident TMPTickets;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table TMPTickets;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Left join LOAD Date as TicketProductiveStartDate, Add1Day as TicketProductiveAdd1Day, Add2Days as TicketProductiveAdd2Days Resident Calendar;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Calculate optimal end timestamp for productive periods, taking weekends / holidays into account&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Result:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *, timestamp(rangesum(daystart(TicketProductiveStart)+interval#('09:00:00'),interval#('12:00:00')-(interval#('17:00:00')-frac(TicketProductiveStart)),&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; if(hour(TicketProductiveStart)&amp;gt;12,TicketProductiveAdd2Days-interval#('08:00:00'),TicketProductiveAdd1Day),1 )) as TicketProductiveEnd;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD TicketProductiveStartDate as Date, TicketProductiveAdd1Day, TicketProductiveAdd2Days, TicketProductiveStart, TicketCreation Resident Tickets;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// drop unneeded fields and tables&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop table Tickets;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop fields Add1Day, Add2Days, TicketProductiveAdd1Day, TicketProductiveAdd2Days,CorrectStartDay;&lt;/EM&gt;&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>Sat, 26 May 2012 14:04:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370476#M493527</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-05-26T14:04:14Z</dc:date>
    </item>
    <item>
      <title>Adjusting Timestamp to Next Work Day</title>
      <link>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370477#M493528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please view this link as well, &lt;/P&gt;&lt;P&gt;It has almost same problem being faced.&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/222932#222932" style="color: #1155cc; font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);" target="_blank"&gt;http://community.qlik.com/message/222932#222932&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 May 2012 07:36:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370477#M493528</guid>
      <dc:creator>adnan_rafiq</dc:creator>
      <dc:date>2012-05-27T07:36:30Z</dc:date>
    </item>
    <item>
      <title>Adjusting Timestamp to Next Work Day</title>
      <link>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370478#M493529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Pefect! Its works! Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 00:39:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adjusting-Timestamp-to-Next-Work-Day/m-p/370478#M493529</guid>
      <dc:creator>villegasi03</dc:creator>
      <dc:date>2012-06-06T00:39:10Z</dc:date>
    </item>
  </channel>
</rss>

