<?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: Match countries to get holidays for NetWorkDays formula in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Match-countries-to-get-holidays-for-NetWorkDays-formula/m-p/755800#M662039</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The syntax of NetWorkDays allows the list of Holidays to be added at the end. In order to make it work, the list of holidays needs to be saved in a variable (not in a field). Here is what I would do in this case:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Load the Holidays per Country with a GROUP BY clause, using the Concat() function to generate the list of all Holidays for each Country. You will need to play with the exact formatting to get it right for the NetWorkDays() &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Read the resulting summary table line by line, fetching the list of Holidays and the Country into two variables, using Peek().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. For each Country, read the first table with the WHERE clause (filtering on the Country field). Use the variable with Holidays in the NetWorkDays function. Something along these lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; Country,&lt;/P&gt;&lt;P&gt;&amp;nbsp; NetWorkDays(StartDate, EndDate, $(vHolidays) as WorkDays&lt;/P&gt;&lt;P&gt;reisdent&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tab1&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;&amp;nbsp; Country = '$(vCountry)'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Repeat this logic in the loop for all countries that exist in the summarized second table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Oleg Troyansky&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Check out my new book &lt;STRONG&gt;QlikView Your Business&lt;/STRONG&gt; - available to pre-order on Amazon!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Feb 2015 20:29:37 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2015-02-05T20:29:37Z</dc:date>
    <item>
      <title>Match countries to get holidays for NetWorkDays formula</title>
      <link>https://community.qlik.com/t5/QlikView/Match-countries-to-get-holidays-for-NetWorkDays-formula/m-p/755799#M662038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm currently working on a Qlikview script, but I'm struggling to figure out a stable NetWorkDays formula in the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me explain what I'm trying to get.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 2 Excel files. File A has the following columns:&lt;/P&gt;&lt;P&gt;- Identical code (first 2 characters of this code are identical to the country code).&lt;/P&gt;&lt;P&gt;- &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Country code (i.e. UK, US, CH, CZ, NL, FR)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- Start date and time&lt;/P&gt;&lt;P&gt;- End date and time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(example file A)&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="174" style="border: 1px solid rgb(0, 0, 0); width: 383px; height: 175px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Identical code&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Country Code&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Start date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;End date&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;UK111111&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;UK&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;31-12-2014 12:00&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2-1-2015 11:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;UK222222&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;UK&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2-1-2015 10:00&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6-1-2015 14:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;FR111111&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;FR&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;30-12-2014 9:30&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6-1-2015 3:15&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File B has the following columns:&lt;/P&gt;&lt;P&gt;- Country code (identical to the country code column in file A)&lt;/P&gt;&lt;P&gt;- Holiday dates&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(example file B)&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="149" style="border: 1px solid #000000; width: 230px; height: 143px;" width="228"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Country Code&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Holiday dates&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;UK&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1-1-2015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;UK&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3-1-2015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;UK&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5-1-2015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;FR&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1-1-2015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;FR&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4-1-2015&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the networkdays I obviously use start and end date of file A. &lt;/P&gt;&lt;P&gt;For the holidays part, I can't get it to match the country code of file A with file B, in order to get all the holiday dates for the specific country.&lt;/P&gt;&lt;P&gt;Since there are a lot of countries and holiday dates in file B, I don't want to use INLINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody help me out?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 19:38:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Match-countries-to-get-holidays-for-NetWorkDays-formula/m-p/755799#M662038</guid>
      <dc:creator />
      <dc:date>2015-02-05T19:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Match countries to get holidays for NetWorkDays formula</title>
      <link>https://community.qlik.com/t5/QlikView/Match-countries-to-get-holidays-for-NetWorkDays-formula/m-p/755800#M662039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The syntax of NetWorkDays allows the list of Holidays to be added at the end. In order to make it work, the list of holidays needs to be saved in a variable (not in a field). Here is what I would do in this case:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Load the Holidays per Country with a GROUP BY clause, using the Concat() function to generate the list of all Holidays for each Country. You will need to play with the exact formatting to get it right for the NetWorkDays() &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Read the resulting summary table line by line, fetching the list of Holidays and the Country into two variables, using Peek().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. For each Country, read the first table with the WHERE clause (filtering on the Country field). Use the variable with Holidays in the NetWorkDays function. Something along these lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; Country,&lt;/P&gt;&lt;P&gt;&amp;nbsp; NetWorkDays(StartDate, EndDate, $(vHolidays) as WorkDays&lt;/P&gt;&lt;P&gt;reisdent&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tab1&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;&amp;nbsp; Country = '$(vCountry)'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Repeat this logic in the loop for all countries that exist in the summarized second table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Oleg Troyansky&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Check out my new book &lt;STRONG&gt;QlikView Your Business&lt;/STRONG&gt; - available to pre-order on Amazon!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 20:29:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Match-countries-to-get-holidays-for-NetWorkDays-formula/m-p/755800#M662039</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2015-02-05T20:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Match countries to get holidays for NetWorkDays formula</title>
      <link>https://community.qlik.com/t5/QlikView/Match-countries-to-get-holidays-for-NetWorkDays-formula/m-p/755801#M662040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Congrats with the book Oleg!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Feb 2015 21:16:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Match-countries-to-get-holidays-for-NetWorkDays-formula/m-p/755801#M662040</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-02-05T21:16:53Z</dc:date>
    </item>
  </channel>
</rss>

