<?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: Custom weekly calendar creation - how to? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345322#M706774</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have finally figured out a solution for the custom weekly calendar part here. Havent resolved the custom production months and year parts yet though, so ideas appreciated. Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/211578#211578"&gt;http://community.qlik.com/message/211578#211578&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Apr 2012 08:45:25 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-04-19T08:45:25Z</dc:date>
    <item>
      <title>Custom weekly calendar creation - how to?</title>
      <link>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345316#M706768</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;Have rummaged through the forums but found nothing that might help resolve this. We have a custom production calendar - the production weeks start on a Saturday and end on a Friday. At the moment I've created an inline table for the current year, but am hoping to figure out a way to automate this in script for historical as well as all future dates without needing to load or enter data. Effectively I'm thinking I want to determine a custom start and end day for a particular year to define week 1 and roll the weeks forward from there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking of using the MakeWeekDate function and then mapping particular days of week to a particular week number for the current year but havent gotten far - because I get to ridiculous results like 7 Jan 2012 falling into weekending Friday 6 Jan 2012. i.e.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="CalDateErr.png" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/12020_CalDateErr.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;I'd appreciate any idea on this or a better solution. Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Script so far is this. Many ideas sourced from &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.rhyous.com/2009/11/20/how-to-create-a-calendar-in-qlikview/"&gt;http://www.rhyous.com/2009/11/20/how-to-create-a-calendar-in-qlikview/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;//---------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;LET vDateMin = Num(MakeDate(2011,1,1));&lt;/P&gt;&lt;P&gt;LET vDateMax = Num(MakeDate(2012,12,31)); &lt;/P&gt;&lt;P&gt;LET vDateToday = Num(Today());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempCalendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;$(vDateMin) + RowNo() - 1 AS DateNumber,&lt;/P&gt;&lt;P&gt;Date($(vDateMin) + RowNo() - 1) AS TempDate&lt;/P&gt;&lt;P&gt;AUTOGENERATE 1&lt;/P&gt;&lt;P&gt;WHILE $(vDateMin)+IterNo()-1&amp;lt;= $(vDateMax);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Date(TempDate) AS CalendarDate,&lt;/P&gt;&lt;P&gt;Week(TempDate) AS CalendarWeek,&lt;/P&gt;&lt;P&gt;Month(TempDate) AS CalendarMonth,&lt;/P&gt;&lt;P&gt;Year(TempDate) AS CalendarYear,&lt;/P&gt;&lt;P&gt;MakeWeekDate(Year(TempDate),Week(TempDate),4) as CalendarWeekEndingFriDate //4=Fri&lt;/P&gt;&lt;P&gt;RESIDENT TempCalendar ORDER BY TempDate ASC;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP TABLE TempCalendar;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//----------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;// I have an inline calendar for 2012 looking like this (but its obviously not an automated future/historical date proof solution)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[2012WEProdCal]:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ProdCalWeek, CalendarWeekEndingFriDate, ProdCalMonth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, 06/01/2012, Jan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 13/01/2012, Jan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, 20/01/2012, Jan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, 27/01/2012, Jan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, 03/02/2012, Feb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6, 10/02/2012, Feb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7, 17/02/2012, Feb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8, 24/02/2012, Feb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9, 02/03/2012, Feb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10, 09/03/2012, Mar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11, 16/03/2012, Mar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12, 23/03/2012, Mar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13, 30/03/2012, Mar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14, 06/04/2012, Apr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15, 13/04/2012, Apr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16, 20/04/2012, Apr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 17, 27/04/2012, Apr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18, 04/05/2012, May&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19, 11/05/2012, May&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20, 18/05/2012, May&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21, 25/05/2012, May&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22, 01/06/2012, May&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23, 08/06/2012, Jun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24, 15/06/2012, Jun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25, 22/06/2012, Jun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26, 29/06/2012, Jun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 27, 06/07/2012, Jul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28, 13/07/2012, Jul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 29, 20/07/2012, Jul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30, 27/07/2012, Jul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31, 03/08/2012, Jul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32, 10/08/2012, Aug&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 33, 17/08/2012, Aug&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34, 24/08/2012, Aug&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35, 31/08/2012, Aug&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36, 07/09/2012, Sep&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 37, 14/09/2012, Sep&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 38, 21/09/2012, Sep&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 39, 28/09/2012, Sep&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40, 05/10/2012, Oct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 41, 12/10/2012, Oct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 42, 19/10/2012, Oct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 43, 26/10/2012, Oct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 44, 02/11/2012, Oct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 45, 09/11/2012, Nov&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 46, 16/11/2012, Nov&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 47, 23/11/2012, Nov&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 48, 30/11/2012, Nov&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 49, 07/12/2012, Dec&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50, 14/12/2012, Dec&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 51, 21/12/2012, Dec&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 52, 28/12/2012, Dec&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 53, 04/01/2013, Jan&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Attached I have a picture of what this calendar looks like for 2012. How can I algorithmically map the Dates from my QV script generated calendar onto the Production weeks so I can determine which date falls into which production week number.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="prodcal2012.png" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/12017_prodcal2012.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;//and for 2011&lt;/P&gt;&lt;P&gt;&lt;IMG alt="aprodcal2011.jpg" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/12019_aprodcal2011.jpg" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 11:34:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345316#M706768</guid>
      <dc:creator />
      <dc:date>2012-03-09T11:34:06Z</dc:date>
    </item>
    <item>
      <title>Custom weekly calendar creation - how to?</title>
      <link>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345317#M706769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did some more RTFM in the online help and found some more functions to test. I think I've solved the first part of my Q - defining the custom start and end dates of my week. It may however, be coincidence that its working because my vDateMin is 1 Jan 2011 which also happens to be a saturday which is the dayofweek I wish to start counting weeks from.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, when I add the following 2 lines to my LOAD script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WeekStart(TempDate,0,-2) as WeekStartingDate, // -2 is days offset from default QV calendar&lt;/P&gt;&lt;P&gt;WeekEnd(TempDate,0,-2) as WeekEndingDate,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get to this. (I have left my old incorrect MakeWeekDate(Year(TempDate),Week(TempDate),4) as CalendarWeekEndingFriDate in the table for comparison purposes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="prodcalstartend.png" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/12022_prodcalstartend.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Given my WeekStartingDate and &lt;/P&gt;&lt;P&gt;WeekEndingDate fields, the CalendarWeek value is incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I modify the script to obtain Week numbers that correspond with my Production calendar?&lt;/P&gt;&lt;P&gt;i.e. Week 1 of 2011 starts on 1 Jan 2011 and ends on 7 Jan 2011 and week 1 of 2012 starts on 31 Dec 2011 and ends on 6 Jan 2012.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 12:31:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345317#M706769</guid>
      <dc:creator />
      <dc:date>2012-03-09T12:31:08Z</dc:date>
    </item>
    <item>
      <title>Custom weekly calendar creation - how to?</title>
      <link>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345318#M706770</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;Use LunarWeekStart() and LunarWeekEnd() for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 12:51:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345318#M706770</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-03-09T12:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Custom weekly calendar creation - how to?</title>
      <link>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345319#M706771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input. I'll concede I'm not entirely clear when I should use LunarWeekStart vs WeekStart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried both, and when I set vDateMin to a different earlier year where 1 Jan doesnt fall on my custom week start day of Sat, LunarWeekStart doesnt correspond to the production calendar I'm trying to replicate in script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;LET vDateMin = Num(MakeDate(2010,1,1));&lt;/P&gt;&lt;P&gt;LET vDateMax = Num(MakeDate(2012,12,31)); &lt;/P&gt;&lt;P&gt;LET vDateToday = Num(Today());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempCalendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;$(vDateMin) + RowNo() - 1 AS DateNumber,&lt;/P&gt;&lt;P&gt;Date($(vDateMin) + RowNo() - 1) AS TempDate,&lt;/P&gt;&lt;P&gt;LunarWeekStart(Date($(vDateMin) + RowNo() - 1),0,-0) as LunarWeekStartingDate, &lt;/P&gt;&lt;P&gt;LunarWeekEnd(Date($(vDateMin) + RowNo() - 1),0,-0) as LunarWeekEndingDate,&lt;/P&gt;&lt;P&gt;WeekStart(Date($(vDateMin) + RowNo() - 1),0,-2) as TempWeekStartingDate, // -2 is days offset from default Mon-Sun QV calendar&lt;/P&gt;&lt;P&gt;WeekEnd(Date($(vDateMin) + RowNo() - 1),0,-2) as TempWeekEndingDate&lt;/P&gt;&lt;P&gt;AUTOGENERATE 1&lt;/P&gt;&lt;P&gt;WHILE $(vDateMin)+IterNo()-1&amp;lt;= $(vDateMax);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//My results are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="12031" alt="lunarvsotherweek.png" class="jive-image-thumbnail jive-image" src="https://community.qlik.com/legacyfs/online/12031_lunarvsotherweek.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;It seems for whatever reason WeekStart is giving me the answer that corresponds to the production calendar I wish to replicate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you suggest a way I can associate a week number in the script - i.e. week 1 to 52 (or 53 if need be) for each Year with the dates in the range of WeekStart to WeekEnd. I suspect it'll require a loop, but I havent figured out any working syntax yet.Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 14:44:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345319#M706771</guid>
      <dc:creator />
      <dc:date>2012-03-09T14:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Custom weekly calendar creation - how to?</title>
      <link>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345320#M706772</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;Hope I understood correctly, you need to arrive a field Week based on Jan 1.&amp;nbsp; For this Use LunarWeekName&lt;A name="LunarWeekName"&gt;&lt;/A&gt;&lt;SPAN style="font-style: italic;"&gt;( ) to get the Week name based on Jan 1&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LunarWeekName('1/1/2012') will give 2012/01i.e, first week of 2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no need to use loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Mar 2012 15:16:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345320#M706772</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-03-09T15:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom weekly calendar creation - how to?</title>
      <link>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345321#M706773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not exactly, my production weeks start on a Saturday and end on a Friday, so unless 1/1/2012 is a Saturday LunarWeek doesnt seem work for me. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now taking 2012 as an example year, for my production calendar, week 1 is from Sat 31 Dec 2011 - Fri 06 Jan 2012, then week 2 is from Sat 07 Jan 2012 - Fri 13 Jan 2012, ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I get the following (I am showing the overlap between years, since every year it needs to revert back to 1 for week 1 (and week 1 may contain a starting date that has the previous years date in it and a production week doesnt necessarily fall only into a signle month as in my 2012 example below) and count up to week 52 before reverting back to week 1). e.g. taking a sample period of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Week Number&amp;nbsp; |&amp;nbsp; WeekStartingDate | WeekEndingDate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 51&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 17/12/2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 23/12/2011&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 52&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp;&amp;nbsp; 24/12/2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 30/12/2011&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; &lt;STRONG&gt;31/12/2011 &lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 06/01/2012&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 07/01/2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 13/01/2012&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 14/01/2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 20/01/2012&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 21/01/2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 27/01/2012&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; &lt;STRONG&gt;28/01/2012&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 03/02/2012 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 04/02/2012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |&amp;nbsp; 10/02/2012 ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've marked the odd dates in (&lt;STRONG&gt;boldtext&lt;/STRONG&gt;) so you can see the where dates dont correspond to std calendar norms.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking one way to do this in script would be to set all the RecNo()'s from vMinDate to the WeekEndingDate for RecNo(1) to week 1 and then the next 7 records after the first WeekEndingDate records to week 2, then the next 7 after that to week 3 ... etc until week 52 then start again on week 1 but I am unsure how to do this in script - I'm thinking possibly with a temporary table and then Peek() back at the previous record and its WeekEndingDate and then applying a Week Number calculation to that - something like check if previous record's WeekEndingDate is different from current record WeekEndingDate and if true then increment Week Number by 1 until WeekEndingDate falls into a new year then start with week numbers of 1 again - possibly using a While loop ... but not entirely sure how to implement such a calculation in practice. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2012 08:14:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345321#M706773</guid>
      <dc:creator />
      <dc:date>2012-03-12T08:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Custom weekly calendar creation - how to?</title>
      <link>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345322#M706774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have finally figured out a solution for the custom weekly calendar part here. Havent resolved the custom production months and year parts yet though, so ideas appreciated. Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/message/211578#211578"&gt;http://community.qlik.com/message/211578#211578&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2012 08:45:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Custom-weekly-calendar-creation-how-to/m-p/345322#M706774</guid>
      <dc:creator />
      <dc:date>2012-04-19T08:45:25Z</dc:date>
    </item>
  </channel>
</rss>

