<?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 Adding days: workdays, weekends, holidays in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038367#M928084</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to add work days to the existing dates and should also keep in mid possible holidays and weekend. I have a separate table with country specific calendars with each day of the year having a value in a separate column to indicate working and non-working day. The table looks like this:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="118792" alt="" class="jive-image image-1" height="219" src="https://community.qlik.com/legacyfs/online/118792_pastedImage_15.png" style="width: 271px; height: 219.326px;" width="271" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1 - weekend/holiday&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;0 - working day&lt;/P&gt;&lt;P&gt;Currently I have weekend and holiday information available for a several countries and for several years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea is to add a certain amount of days to the date column and if calculated date falls on the weekend or holiday transfer it to the next working day. I created a column with non-working days as "1" so that it helps me to calculate by adding necessary amount of day to the final date. But I know there is a way of adding working days with &lt;EM&gt;&lt;STRONG&gt;LastWorkDate(StartDate, NumberOfDays)&lt;/STRONG&gt;&lt;/EM&gt; but this only considers weekends.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My current formulas is &lt;EM&gt;&lt;STRONG&gt;LastWorkDate(&amp;lt;date&amp;gt;,&amp;lt;deliveryDays&amp;gt;)&lt;/STRONG&gt;&lt;/EM&gt; in the dashboard. I plan to have this implemented in the script side later.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;&lt;EM&gt;date&lt;/EM&gt;&amp;gt;&lt;/STRONG&gt; retrieves specific date and &lt;STRONG&gt;&amp;lt;&lt;EM&gt;deliveryDays&lt;/EM&gt;&amp;gt;&lt;/STRONG&gt; retrieves a number of days(int) for each entry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each entry has a country information and thus link to the calendar table shown below(originally TFACS table from SAP).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With &lt;EM&gt;&lt;STRONG&gt;NetWorkDays()&lt;/STRONG&gt;&lt;/EM&gt; I can also use holidays information but here I am not sure how to do it properly.&amp;nbsp; I am quite new to QlikView and to scripting in general and this seems a bit tricky. Maybe someone can propose any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038367#M928084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to add work days to the existing dates and should also keep in mid possible holidays and weekend. I have a separate table with country specific calendars with each day of the year having a value in a separate column to indicate working and non-working day. The table looks like this:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="118792" alt="" class="jive-image image-1" height="219" src="https://community.qlik.com/legacyfs/online/118792_pastedImage_15.png" style="width: 271px; height: 219.326px;" width="271" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;1 - weekend/holiday&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;0 - working day&lt;/P&gt;&lt;P&gt;Currently I have weekend and holiday information available for a several countries and for several years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea is to add a certain amount of days to the date column and if calculated date falls on the weekend or holiday transfer it to the next working day. I created a column with non-working days as "1" so that it helps me to calculate by adding necessary amount of day to the final date. But I know there is a way of adding working days with &lt;EM&gt;&lt;STRONG&gt;LastWorkDate(StartDate, NumberOfDays)&lt;/STRONG&gt;&lt;/EM&gt; but this only considers weekends.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My current formulas is &lt;EM&gt;&lt;STRONG&gt;LastWorkDate(&amp;lt;date&amp;gt;,&amp;lt;deliveryDays&amp;gt;)&lt;/STRONG&gt;&lt;/EM&gt; in the dashboard. I plan to have this implemented in the script side later.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;&lt;EM&gt;date&lt;/EM&gt;&amp;gt;&lt;/STRONG&gt; retrieves specific date and &lt;STRONG&gt;&amp;lt;&lt;EM&gt;deliveryDays&lt;/EM&gt;&amp;gt;&lt;/STRONG&gt; retrieves a number of days(int) for each entry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each entry has a country information and thus link to the calendar table shown below(originally TFACS table from SAP).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With &lt;EM&gt;&lt;STRONG&gt;NetWorkDays()&lt;/STRONG&gt;&lt;/EM&gt; I can also use holidays information but here I am not sure how to do it properly.&amp;nbsp; I am quite new to QlikView and to scripting in general and this seems a bit tricky. Maybe someone can propose any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038367#M928084</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038368#M928085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The LastWorkDate function also accepts a list of dates as holidays, just as the networkdays function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the help file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;A name="kanchor528"&gt;&lt;/A&gt;&lt;A name="lastworkdate"&gt;&lt;/A&gt;&lt;SPAN class="Bold"&gt;&lt;STRONG&gt;&lt;EM&gt;lastworkdate(&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class="Italic"&gt;start_date, no_of_workdays {, holiday}&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Returns the earliest ending date to achieve &lt;SPAN class="Italic"&gt;number_of_workdays&lt;/SPAN&gt; (Monday-Friday) if starting at &lt;SPAN class="Italic"&gt;start_date&lt;/SPAN&gt; taking into account any optionally listed &lt;SPAN class="Italic"&gt;holidays&lt;/SPAN&gt;. &lt;SPAN class="Italic"&gt;Start_date&lt;/SPAN&gt; and &lt;SPAN class="Italic"&gt;holiday&lt;/SPAN&gt; should be valid dates or timestamps. &lt;/P&gt;&lt;P class="example"&gt;&lt;STRONG&gt;Examples:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;lastworkdate ('2007-02-19', 9)&lt;/SPAN&gt; returns '2007-03-01'&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;lastworkdate ('2006-12-18', 8, '2006-12-25', '2006-12-26')&lt;/SPAN&gt; returns '2006-12-29'&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Mar 2016 14:31:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038368#M928085</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-03-21T14:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038369#M928086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I actually realized that &lt;EM&gt;&lt;STRONG&gt;LastWorkDate()&lt;/STRONG&gt;&lt;/EM&gt; is not exactly what I need. It returns the last working day of the week where my calculation ends. That means, if the calculated date falls on Saturday &lt;EM&gt;&lt;STRONG&gt;LastWorkDate() &lt;/STRONG&gt;&lt;/EM&gt;returns Friday's date. It always returns previous working day if it falls on the same week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With a bit of experimenting I get this:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="118821" alt="" class="jive-image image-1" height="201" src="https://community.qlik.com/legacyfs/online/118821_pastedImage_1.png" style="max-width: 1200px; max-height: 900px; width: 566px; height: 201.148px;" width="566" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example above:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: 'Holiday Table' consist of both weekends and holidays. '2015-04-04' is Saturday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the "Calc.Date" I add 3 days to the original date. After adding 3 days '2015-04-01' becomes '2015-04-04' which is Saturday. It returns '2015-04-03'(Last working day = Friday). I need to return the next working day which is Monday '2015-04-06'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Mar 2016 15:38:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038369#M928086</guid>
      <dc:creator />
      <dc:date>2016-03-21T15:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038370#M928087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like you need the FirstWorkDate function then.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Mar 2016 16:32:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038370#M928087</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-03-21T16:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038371#M928088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to add days to the original date while FirstWorkDate substracts days from the specified end date (which I don't know and need to calculate).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Mar 2016 16:41:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038371#M928088</guid>
      <dc:creator />
      <dc:date>2016-03-21T16:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038372#M928089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Uhm, right. My mistake. But LastWorkDate should return the first date to achieve the number of workdays you specified:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold" style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold" style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;STRONG&gt;lastworkdate(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;SPAN class="Italic"&gt;start_date, no_of_workdays {, holiday}&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Returns the earliest ending date to achieve &lt;SPAN class="Italic"&gt;number_of_workdays&lt;/SPAN&gt; (Monday-Friday) if starting at &lt;SPAN class="Italic"&gt;start_date&lt;/SPAN&gt; taking into account any optionally listed &lt;SPAN class="Italic"&gt;holidays&lt;/SPAN&gt;. &lt;SPAN class="Italic"&gt;Start_date&lt;/SPAN&gt; and &lt;SPAN class="Italic"&gt;holiday&lt;/SPAN&gt; should be valid dates or timestamps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you sure your specifying the correct number of workdays? Are you perhaps subtracting two dates? The difference between two consecutive days is one, but they're still two days. Or to put it another way LastWorkDate(Today(),1) will return today's date.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Mar 2016 17:15:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038372#M928089</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-03-21T17:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038373#M928090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made it working with the FIrstWorkDate(Orig.Date, DaysToAdd, Holidays) but there is another problem now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Holidays calendar table consists of multiple countries and country specific calendars. I store the values of all holidays into a variable but then it retrieves all holidays and uses them in my calculations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My current script is similar to this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;//Loading calendar information&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt; //Calendar_id=Country code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HolidayCalendar:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD Calendar_id,&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATUM, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;//DATUM consists of holidays (each date on a separate row)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmpConcat:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load Concat(chr(39) &amp;amp; DATUM &amp;amp; chr(39),',' ) as HolidayDates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Resident HolidayCalendar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;//Retrieving the values of the holidays and assigning them into a var&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let vPublicHolidays = FieldValue('HolidayDates',1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The line above stores all holidays despite of the country which is not desirable in my calculation. I was wondering if there is a good way of splitting the countries and storing all country specific holidays separately. I have many countries and many dates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2016 10:44:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038373#M928090</guid>
      <dc:creator />
      <dc:date>2016-03-24T10:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038374#M928091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could let users select a country and use the concat expression in the front end. That will get the user a list of holidays for the selected country to be used in the FirstWorkDate expression. The alternative is to create a variable for each country in the script by looping through the countries and generating a load statement that retrieves the holidays for that country and stores the list in a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=1 to FieldValueCount('Country')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vCountry = FieldValue('Country', $(i));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Temp:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat(chr(39) &amp;amp; DATUM &amp;amp; chr(39), ',') as HolidayDates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RESIDENT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HolidayCalendar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Country = '$(vCountry)'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vPublicHolidays_$(vCountry) = peek('HolidayDate',-1,'Temp');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DROP TABLE Temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2016 11:30:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038374#M928091</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-03-24T11:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038375#M928092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your help, Gysbert!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have another question. The script suggested by you works fine and creates separate variables with a list of country specific holidays. Now I would like to know if there any way to use those variables according to the country. Countries are not being selected but in the data table each entry has a country information and new dates should be calculated using the appropriate country-specific holidays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/119783_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;As in the table above I have 'CN' values in Cal.ID columns(country code). Each entry has a reference to a certain country, e.g. CN, US and others, and I would like to use automatically correct variable in &lt;STRONG&gt;L&lt;/STRONG&gt;&lt;SPAN class="Bold" style="font-size: 10pt;"&gt;&lt;STRONG&gt;astWorkDate(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt;"&gt;&lt;SPAN class="Italic"&gt;start_date, no_of_workdays {, holiday}&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;) &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="Bold"&gt;formula.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;I can think of some kind of partial match. For example, &lt;STRONG&gt;&lt;EM&gt;if(Match(Country, $(vCountry)), LastWorkDate(&amp;lt;date&amp;gt;,&amp;lt;daystoadd&amp;gt;, vPublicHolidays&amp;amp;$(vCountry))&lt;/EM&gt;&lt;/STRONG&gt;. I tried to use the Match formula in order to return the list of holidays &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;&lt;STRONG&gt;=if(Match(Country, vCountry),vPublicHolidays&amp;amp;$(vCountry))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt; &lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;&lt;SPAN class="Bold"&gt;but it works only for 1 value as &lt;STRONG&gt;&lt;EM&gt;vCountry&lt;/EM&gt;&lt;/STRONG&gt; is holding only the value for the last loaded holiday calendar. I could trim all &lt;SPAN class="Bold"&gt;&lt;EM&gt;&lt;STRONG&gt;vPublicHolidays&amp;amp;$(vCountry)&lt;/STRONG&gt;&lt;/EM&gt; variables and compare each of them to the Country name but that is not practical as there are multiple countries in the list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;&lt;SPAN class="Bold"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;&lt;SPAN class="Bold"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;&lt;SPAN class="Bold"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 08:06:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1038375#M928092</guid>
      <dc:creator />
      <dc:date>2016-03-30T08:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adding days: workdays, weekends, holidays</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1663502#M928093</link>
      <description>&lt;P&gt;In case anybody else tries out&amp;nbsp; Gysbert's code it works perfect when minor typo with field name HolidayDate&lt;STRONG&gt;s&lt;/STRONG&gt; is corrected:&lt;/P&gt;&lt;P&gt;FOR i=1 to FieldValueCount('Country')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vCountry = FieldValue('Country', $(i));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Temp:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat(chr(39) &amp;amp; DATUM &amp;amp; chr(39), ',') as HolidayDates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RESIDENT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HolidayCalendar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Country = '$(vCountry)'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vPublicHolidays_$(vCountry) = peek('HolidayDate&lt;STRONG&gt;s&lt;/STRONG&gt;',-1,'Temp');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DROP TABLE Temp;&lt;/P&gt;&lt;P&gt;NEXT&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 00:12:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-days-workdays-weekends-holidays/m-p/1663502#M928093</guid>
      <dc:creator>HurikanLorenzo</dc:creator>
      <dc:date>2020-01-08T00:12:23Z</dc:date>
    </item>
  </channel>
</rss>

