<?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: Generate the fortnight (two weeks) time intervals for a given date range in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539405#M599941</link>
    <description>&lt;P&gt;Hi Check the below code for generating the weekstart and enddates for the required dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Date:
LOAD * INLINE [
    DateFrom, DateTo
    25/06/2018, 5/08/2018
];

Let vMin=Num(Date#(Peek('DateFrom'),'DD/MM/YYYY'));
Let vMax=Num(Date#(Peek('DateTo'),'DD/MM/YYYY'));

Drop table Date;

Temp:
Load 
Date($(vMin) + RowNo() - 1) AS Vacation_Date
AutoGenerate (1)
WHILE $(vMin) + IterNo() -1 &amp;lt;= $(vMax);

Data:
Load *,
WeekStart(Vacation_Date) &amp;amp; 'To ' &amp;amp; WeekEnd(Vacation_Date)  as  Week_Range

Resident Temp;

DROP table Temp;&lt;/PRE&gt;&lt;P&gt;Do the mods required for your requirement accordingly. Let me know if any.&lt;/P&gt;&lt;P&gt;PFA &lt;STRONG&gt;QVW&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Hirish&lt;/P&gt;</description>
    <pubDate>Tue, 05 Feb 2019 06:42:45 GMT</pubDate>
    <dc:creator>HirisH_V7</dc:creator>
    <dc:date>2019-02-05T06:42:45Z</dc:date>
    <item>
      <title>Generate the fortnight (two weeks) time intervals for a given date range</title>
      <link>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539384#M599940</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I need to generate the two weeks time periods for a given date range.&lt;/P&gt;&lt;P&gt;For an example, assume the date range is 25/06/2018 - 5/08/2018, the resulted output should be;&lt;/P&gt;&lt;P&gt;25/06/2018 - 8/07/2018&lt;/P&gt;&lt;P&gt;9/07/2018 - 22/07/2018&lt;/P&gt;&lt;P&gt;23/07/2018 - 5/08/2018.&lt;/P&gt;&lt;P&gt;I found the below code to generate the in between dates which is working fine.&lt;/P&gt;&lt;P&gt;"Vacation Start Date" + IterNo() -1 as "Vacation Date"&lt;BR /&gt;Resident Vacation_Dates_Table&lt;BR /&gt;WHILE "Vacation Start Date" + IterNo() -1 &amp;lt;= "Vacation End Date";&lt;/P&gt;&lt;P&gt;Need a similar one to generate the above said intervals and need to group them (ex - 25/06/2018 - 8/07/2018) as shown above.&lt;/P&gt;&lt;P&gt;Appreciate you valuable feedback in advance.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 05:43:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539384#M599940</guid>
      <dc:creator>andymanu</dc:creator>
      <dc:date>2019-02-05T05:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Generate the fortnight (two weeks) time intervals for a given date range</title>
      <link>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539405#M599941</link>
      <description>&lt;P&gt;Hi Check the below code for generating the weekstart and enddates for the required dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Date:
LOAD * INLINE [
    DateFrom, DateTo
    25/06/2018, 5/08/2018
];

Let vMin=Num(Date#(Peek('DateFrom'),'DD/MM/YYYY'));
Let vMax=Num(Date#(Peek('DateTo'),'DD/MM/YYYY'));

Drop table Date;

Temp:
Load 
Date($(vMin) + RowNo() - 1) AS Vacation_Date
AutoGenerate (1)
WHILE $(vMin) + IterNo() -1 &amp;lt;= $(vMax);

Data:
Load *,
WeekStart(Vacation_Date) &amp;amp; 'To ' &amp;amp; WeekEnd(Vacation_Date)  as  Week_Range

Resident Temp;

DROP table Temp;&lt;/PRE&gt;&lt;P&gt;Do the mods required for your requirement accordingly. Let me know if any.&lt;/P&gt;&lt;P&gt;PFA &lt;STRONG&gt;QVW&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Hirish&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 06:42:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539405#M599941</guid>
      <dc:creator>HirisH_V7</dc:creator>
      <dc:date>2019-02-05T06:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Generate the fortnight (two weeks) time intervals for a given date range</title>
      <link>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539925#M599942</link>
      <description>&lt;P&gt;Hi Hirish,&lt;/P&gt;&lt;P&gt;Thanks for the valuable reply.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FirstWeekDay=6" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/5257i2262AD20FC49B938/image-size/large?v=v2&amp;amp;px=999" role="button" title="With the default settings (First Week Day).jpg" alt="FirstWeekDay=6" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;FirstWeekDay=6&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, after changing the default setting to 7 (instead of 6), I was able to get the expected results.&lt;/P&gt;&lt;P&gt;1. Is there any other way to overcome the above said without changing the default main page setting?&lt;/P&gt;&lt;P&gt;2. In addition to above,&amp;nbsp; I want to group the weeks in to pairs (cos generally, the salaries are paid fortnightly and it is based on the hours worked for the respective fortnight).&lt;/P&gt;&lt;P&gt;Could you please help me with grouping the individual Week_Range in to pairs and the final result for the above provided date range should be,&lt;/P&gt;&lt;P&gt;25/06/2018 To 8/07/2018&lt;/P&gt;&lt;P&gt;9/07/2018 To 22/07/2018&lt;/P&gt;&lt;P&gt;23/07/2018 To 5/08/2018&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is working but had to change one of the default setting of the "Main" page . After changing the&amp;nbsp; "SET FirstWeekDay=7;"&lt;/P&gt;&lt;P&gt;only it gave the correct results. Is there any other way I could&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 23:07:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539925#M599942</guid>
      <dc:creator>andymanu</dc:creator>
      <dc:date>2019-02-05T23:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Generate the fortnight (two weeks) time intervals for a given date range</title>
      <link>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539926#M599943</link>
      <description>&lt;P&gt;Please disregard the last few lines starting with " It is working but ...." cos I have forgotten to delete that bit&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 23:09:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1539926#M599943</guid>
      <dc:creator>andymanu</dc:creator>
      <dc:date>2019-02-05T23:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Generate the fortnight (two weeks) time intervals for a given date range</title>
      <link>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1540007#M599944</link>
      <description>&lt;P&gt;Please Find attached updated QVW.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pl Check below code, hope it answers all your queries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Date:
LOAD * INLINE [
    DateFrom, DateTo
    25/06/2018, 5/08/2018
];

Let vMin=Num(Date#(Peek('DateFrom'),'DD/MM/YYYY'));
Let vMax=Num(Date#(Peek('DateTo'),'DD/MM/YYYY'));

Drop table Date;

Temp:
Load 
Date($(vMin) + RowNo() - 1) AS Vacation_Date
AutoGenerate (1)
WHILE $(vMin) + IterNo() -1 &amp;lt;= $(vMax);

Data:
Load *,
If(Mod(Week(Vacation_Date,0,7),2)=0,
WeekStart(Vacation_Date,0,7) &amp;amp; ' To ' &amp;amp; WeekEnd(Vacation_Date,1,7),
WeekStart(Vacation_Date,-1,7) &amp;amp; ' To ' &amp;amp; WeekEnd(Vacation_Date,0,7)) as Week_Range


Resident Temp;

DROP table Temp;&lt;/PRE&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Hirish&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 07:34:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1540007#M599944</guid>
      <dc:creator>HirisH_V7</dc:creator>
      <dc:date>2019-02-06T07:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Generate the fortnight (two weeks) time intervals for a given date range</title>
      <link>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1540551#M599945</link>
      <description>HI Hirish,&lt;BR /&gt;Thank you very much Hirish.&lt;BR /&gt;Yes, its working now as I expected. Thanks a lot, learned something new about grouping weeks also.&lt;BR /&gt;Really great.......&lt;BR /&gt;Your answer was clear and prompt.&lt;BR /&gt;Kind regards,&lt;BR /&gt;Andy&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Feb 2019 21:49:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1540551#M599945</guid>
      <dc:creator>andymanu</dc:creator>
      <dc:date>2019-02-06T21:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Generate the fortnight (two weeks) time intervals for a given date range</title>
      <link>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1540589#M599946</link>
      <description>No problem!&lt;BR /&gt;Enjoy Qliking.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Feb 2019 05:29:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Generate-the-fortnight-two-weeks-time-intervals-for-a-given-date/m-p/1540589#M599946</guid>
      <dc:creator>HirisH_V7</dc:creator>
      <dc:date>2019-02-07T05:29:18Z</dc:date>
    </item>
  </channel>
</rss>

