<?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: Bank holiday Exclusion in calculation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963760#M330514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can run a code snippet like this to populate a variable with a list of holidays&lt;/P&gt;&lt;P&gt;This uses the website timeanddate.com, but you could use an Excel file source or database. It also covers several years, so if you only need the current year, you don't need the For loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//----------------------------------------------------------------------------------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set zPriorYears = 5; // Number of prior years to include in calendar&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set zFutureYears = 3; // Number of future years to include in calendar&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let zToday = Today(1); // Date parameter (for unit testing, use other dates here)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//----------------------------------------------------------------------------------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Get holiday dates from timanddate.com &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//----------------------------------------------------------------------------------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let zMinYear = Year(YearStart(AddYears(zToday - 5, -zPriorYears)));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let zMaxYear = Year(YearEnd(AddYears(zToday, zFutureYears)));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For zi = zMinYear to zMaxYear&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; tmpHolidays:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; LOAD &lt;/EM&gt;&lt;EM&gt;Date(Date#(Date &amp;amp; ' ' &amp;amp; $(zi), 'MMM D YYYY')) As Date&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;nbsp; FROM [&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.timeanddate.com/holidays/uk/$(zi" rel="nofollow"&gt;http://www.timeanddate.com/holidays/uk/$(zi&lt;/A&gt;&lt;SPAN&gt;)]&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; (html, codepage is 1252, embedded labels, table is @1)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Where [Holiday type] = 'Public Holiday';&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; ;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Next&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;tmpConcatHolidays:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD chr(39) &amp;amp; Concat(Date, chr(39) &amp;amp; ',' &amp;amp; chr(39)) &amp;amp; chr(39) As HolidayList&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident tmpHolidays;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vHolidayList = Peek('HolidayList');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Tables tmpHolidays, tmpConcatHolidays;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you have a variable &lt;EM style="font-size: 13.3333px;"&gt;vHolidayList &lt;/EM&gt;that contains the list of holidays. Use this in networkday() like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=NetWorkDays(start, finish, $(vHolidayList))&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Sep 2015 07:05:46 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2015-09-30T07:05:46Z</dc:date>
    <item>
      <title>Bank holiday Exclusion in calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963758#M330512</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 a requirement where I need to calculate the Resolution timing i.e Date Finish - Date Start.&lt;/P&gt;&lt;P&gt;From this calculation I need to exclude the bank holidays and weekends.&lt;/P&gt;&lt;P&gt;I know I need to use NetworkDays function to exclude the holidays but I am confused as to where to apply this?&lt;/P&gt;&lt;P&gt;Should I use it in the script while loading the Date Finish and Date Start and then use the Set analysis on the chart?&lt;/P&gt;&lt;P&gt;Any idea how I can implement this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 04:47:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963758#M330512</guid>
      <dc:creator>mugdhaojha</dc:creator>
      <dc:date>2015-09-30T04:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Bank holiday Exclusion in calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963759#M330513</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;afaIk, Networkdays() will exclude the weekends, but not bank holidays.&lt;/P&gt;&lt;P&gt;For these - well, what I do is, I have a master_calendar (as a qvs file to INCLUDE) which I use in every one of my apps, and I have a list of all the bank holidays of one year which is fed into that calendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I imagine if you have such a list and you have some kind of date in your table, you could also join the list (with a LEFT JOIN, the main table being the primary one) and see where you have a match - those should be the bank holidays.&lt;/P&gt;&lt;P&gt;=&amp;gt; Then you can calculate a flag_field like "workday/ holiday" (or simply 1 and 0) based on that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: This is the third post by me - in a row - that goes into moderation before being published. There must be something wrong with the admins'&amp;nbsp; random generator or something ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 06:57:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963759#M330513</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-09-30T06:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Bank holiday Exclusion in calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963760#M330514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can run a code snippet like this to populate a variable with a list of holidays&lt;/P&gt;&lt;P&gt;This uses the website timeanddate.com, but you could use an Excel file source or database. It also covers several years, so if you only need the current year, you don't need the For loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//----------------------------------------------------------------------------------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set zPriorYears = 5; // Number of prior years to include in calendar&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set zFutureYears = 3; // Number of future years to include in calendar&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let zToday = Today(1); // Date parameter (for unit testing, use other dates here)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//----------------------------------------------------------------------------------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// Get holiday dates from timanddate.com &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//----------------------------------------------------------------------------------------------------&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let zMinYear = Year(YearStart(AddYears(zToday - 5, -zPriorYears)));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let zMaxYear = Year(YearEnd(AddYears(zToday, zFutureYears)));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For zi = zMinYear to zMaxYear&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; tmpHolidays:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; LOAD &lt;/EM&gt;&lt;EM&gt;Date(Date#(Date &amp;amp; ' ' &amp;amp; $(zi), 'MMM D YYYY')) As Date&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;nbsp; FROM [&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.timeanddate.com/holidays/uk/$(zi" rel="nofollow"&gt;http://www.timeanddate.com/holidays/uk/$(zi&lt;/A&gt;&lt;SPAN&gt;)]&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; (html, codepage is 1252, embedded labels, table is @1)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Where [Holiday type] = 'Public Holiday';&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; ;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Next&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;tmpConcatHolidays:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD chr(39) &amp;amp; Concat(Date, chr(39) &amp;amp; ',' &amp;amp; chr(39)) &amp;amp; chr(39) As HolidayList&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident tmpHolidays;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vHolidayList = Peek('HolidayList');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Tables tmpHolidays, tmpConcatHolidays;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you have a variable &lt;EM style="font-size: 13.3333px;"&gt;vHolidayList &lt;/EM&gt;that contains the list of holidays. Use this in networkday() like this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=NetWorkDays(start, finish, $(vHolidayList))&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 07:05:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963760#M330514</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-09-30T07:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Bank holiday Exclusion in calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963761#M330515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="t1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100450_t1.png" style="height: 642px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 07:07:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Bank-holiday-Exclusion-in-calculation/m-p/963761#M330515</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-09-30T07:07:51Z</dc:date>
    </item>
  </channel>
</rss>

