<?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: How to create week fields with dynamic input date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467798#M174691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Taken from p339 of Reference Manual:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;week&lt;/STRONG&gt;(date)&lt;/P&gt;&lt;P&gt;Week number. Returns an integer representing the week when the fraction of expr is interpreted as a date&lt;/P&gt;&lt;P&gt;according to the standard number interpretation.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;week( '1971-10-30' ) returns &lt;EM&gt;43&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;If the date format used does not correspond to the one set in the operating system, QlikView will not be able&lt;/P&gt;&lt;P&gt;to make a correct interpretation. See above under day(date) (page 339).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Dec 2012 11:02:44 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-12-28T11:02:44Z</dc:date>
    <item>
      <title>How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467792#M174685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys can anyone help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to archive the following but not sure how to go about it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create week fields as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;T+1 = Prior to current week&lt;/P&gt;&lt;P&gt;T-0 = Current week&lt;/P&gt;&lt;P&gt;T-1 = one week from the current week&lt;/P&gt;&lt;P&gt;T-2 = two weeks from the current week&lt;/P&gt;&lt;P&gt;T-3 = three weeks from the current week&lt;/P&gt;&lt;P&gt;T-4 = four weeks from the current week&lt;/P&gt;&lt;P&gt;T-5 = five weeks from the current week&lt;/P&gt;&lt;P&gt;T-6 = six weeks from the current week&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'T-0' (current week) needs to be a dynamic variable where the user enters the date in to an input box they wish to report on and T-1, T-2, etc change accordingly to whatever date has been entered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2012 10:14:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467792#M174685</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-27T10:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467793#M174686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would use something like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET T1Start = "=WeekStart(vSelectedDate+7)";&lt;/P&gt;&lt;P&gt;SET T1End = "=WeekEnd(vSelectedDate+7)";&lt;/P&gt;&lt;P&gt;SET T0Start = "=WeekStart(vSelectedDate)";&lt;/P&gt;&lt;P&gt;SET T0End = "=WeekEnd(vSelectedDate)";&lt;/P&gt;&lt;P&gt;SET Tm1Start = "=WeekStart(vSelectedDate-7)";&lt;/P&gt;&lt;P&gt;SET Tm1End = "=WeekEnd(vSelectedDate-7)";&lt;/P&gt;&lt;P&gt;SET Tm2Start = "=WeekStart(vSelectedDate-14)";&lt;/P&gt;&lt;P&gt;SET Tm2End = "=WeekEnd(vSelectedDate-14)"; ... etc ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2012 14:40:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467793#M174686</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-27T14:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467794#M174687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a calendar object and connect the value of calendar object to a variable&lt;/P&gt;&lt;P&gt;For example if the variable name is vVar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can define the other varibles as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let TCurr= Weekstart(vVar);&lt;/P&gt;&lt;P&gt;Let TPrev=WeekStart(vVar,-1);&lt;/P&gt;&lt;P&gt;Let Tafter =WeekStart(vVar,1);&lt;/P&gt;&lt;P&gt;and so forth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2012 14:57:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467794#M174687</guid>
      <dc:creator />
      <dc:date>2012-12-27T14:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467795#M174688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;H Pauljin, how would I get the value of a calendar object and assign it to a variable? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2012 15:14:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467795#M174688</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-27T15:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467796#M174689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right click New Sheet Object &amp;gt; Slider/Calendar Object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remember to create the variable before creating the calendar object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at the file I attached to see the properties of calendar object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jiveImage" src="https://community.qlik.com/message/295118/" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2012 15:56:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467796#M174689</guid>
      <dc:creator />
      <dc:date>2012-12-27T15:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467797#M174690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of creating variables is there a way of creating each of the weeks as fields instead?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2012 09:47:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467797#M174690</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-28T09:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467798#M174691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Taken from p339 of Reference Manual:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;week&lt;/STRONG&gt;(date)&lt;/P&gt;&lt;P&gt;Week number. Returns an integer representing the week when the fraction of expr is interpreted as a date&lt;/P&gt;&lt;P&gt;according to the standard number interpretation.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;week( '1971-10-30' ) returns &lt;EM&gt;43&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;If the date format used does not correspond to the one set in the operating system, QlikView will not be able&lt;/P&gt;&lt;P&gt;to make a correct interpretation. See above under day(date) (page 339).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2012 11:02:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467798#M174691</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-28T11:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467799#M174692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of creating variables is there a way of creating each of the weeks as fields instead? as i will need to use the weeks (T0-T6) as dimensions in charts&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2012 11:21:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467799#M174692</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-28T11:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467800#M174693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are happy to just analyse the previous weeks based upon the date of the document reload, then you can create a new WeekType field in your calendar like this (with TempDate being the date you base the creation of your calendar upon ... see post &lt;A _jive_internal="true" class="loading" href="https://community.qlik.com/message/291974#291974" title="http://community.qlik.com/message/291974#291974"&gt;http://community.qlik.com/message/291974#291974&lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(week(TempDate)=Week(Today()),'T0',&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(week(TempDate)=Week(Today()-7),'Tm1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(week(TempDate)=Week(Today()-14),'Tm2', ..... etc&lt;/P&gt;&lt;P&gt;))) AS WeekType,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It gets tricky however if you still want the application to work with a dynamic date, where the user can change the analysis date using a calendar. You would have to create a seperate table linked to your calendar table, which has the different dates that correspond to the previous weeks for each date in the calendar. If this is the case then variables are safer as having multiple dates is confusing.&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2012 14:02:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467800#M174693</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-28T14:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467801#M174694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the using variables will be easier. The user wants to use an input box in the UI where they enter the date, this date then needs to be stored into a variable and the weeks then change or what ever date has been input. How do I create this input box that stores the date into a dynamic variable? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have had tried a few things but it doesn't seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Dec 2012 11:36:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467801#M174694</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-29T11:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467802#M174695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Right-click &amp;gt; New sheet object &amp;gt; Input box&lt;/P&gt;&lt;P&gt;Select new Variable&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Dec 2012 22:48:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467802#M174695</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-30T22:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467803#M174696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys I think i am almost there i have created the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET TCurr= WEEKSTART($(vVar)); //T-0&lt;/P&gt;&lt;P&gt;SET TPrev= WEEKSTART($(vVar),-1); //T+1&lt;/P&gt;&lt;P&gt;SET TAfterOne= WEEKSTART($(vVar),+1); //T-1&lt;/P&gt;&lt;P&gt;SET TAfterTwo= WEEKSTART($(vVar),+2); //T-2&lt;/P&gt;&lt;P&gt;SET TAfterThree= WEEKSTART($(vVar),+3); //T-3&lt;/P&gt;&lt;P&gt;SET TAfterFour= WEEKSTART($(vVar),+4); //T-4&lt;/P&gt;&lt;P&gt;SET TAfterFive= WEEKSTART($(vVar),+5); //T-5&lt;/P&gt;&lt;P&gt;SET TAfterSix= WEEKSTART($(vVar),+6); //T-6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I am having now is WEEKSTART function is giving me all dates from the Start of the week (Monday)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I change this so that the start of the week can be any day the user selects? e.g if the user selects a date that falls on a Wednesday then all the days will changing according to that? and the Wednesday will taken as the start of the week.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jan 2013 10:07:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467803#M174696</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-01-02T10:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create week fields with dynamic input date</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467804#M174697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WeekStart takes a 3rd parameter (weekoffset), which you can make a configurable variable: See Reference manual, page 349 (Qv11):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WeekStart(&lt;/STRONG&gt;date [, shift = 0 [,weekoffset = 0]])&lt;/P&gt;&lt;P&gt;Returns a value corresponding to a timestamp with the first millisecond of the first date ( Monday ) of&lt;/P&gt;&lt;P&gt;the calendar week containing date. The default output format will be the DateFormat set in the script.&lt;/P&gt;&lt;P&gt;Shift is an integer, where the value 0 indicates the week which contains date. Negative values in&lt;/P&gt;&lt;P&gt;shift indicate preceding weeks and positive values indicate succeeding weeks. If you want to work&lt;/P&gt;&lt;P&gt;with weeks not starting midnight between Sunday and Monday, indicate an offset in days in weekoffset. This may be given as a real number indicating days and/or fractions of a day.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jan 2013 10:28:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-week-fields-with-dynamic-input-date/m-p/467804#M174697</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-01-02T10:28:39Z</dc:date>
    </item>
  </channel>
</rss>

