<?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: Addmonths in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956421#M648724</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;By using your date field ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can create a flag in Script,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If(Date&amp;gt;= AddMonths(Today(), -3), 1)as Last3MonthFlag&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in the front end you call it like,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;EM&gt;Last3MonthFlag={1}&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;for 3 months data in chart to be displayed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I hope this helps you .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Bunny&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Oct 2015 09:39:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-10-12T09:39:01Z</dc:date>
    <item>
      <title>Addmonths in script</title>
      <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956419#M648722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to create transactions for a time period in a load script where I adding months within a time interval. &lt;/P&gt;&lt;P&gt;For example an action will happen every fourth month within the period 1.1.2014-30.6.2015 then I will need transactions with the following dates:&lt;/P&gt;&lt;P&gt;1.1.2014&lt;/P&gt;&lt;P&gt;1.5.2014&lt;/P&gt;&lt;P&gt;1.9.2014&lt;/P&gt;&lt;P&gt;1.1.2015&lt;/P&gt;&lt;P&gt;1.5.2015&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank's&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 09:30:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956419#M648722</guid>
      <dc:creator />
      <dc:date>2015-10-12T09:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Addmonths in script</title>
      <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956420#M648723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you need to create rows with transactions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 09:37:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956420#M648723</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2015-10-12T09:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Addmonths in script</title>
      <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956421#M648724</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;By using your date field ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can create a flag in Script,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If(Date&amp;gt;= AddMonths(Today(), -3), 1)as Last3MonthFlag&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in the front end you call it like,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;EM&gt;Last3MonthFlag={1}&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;for 3 months data in chart to be displayed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I hope this helps you .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Bunny&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 09:39:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956421#M648724</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-12T09:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Addmonths in script</title>
      <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956422#M648725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes&amp;nbsp; I need to create transaction to my fact table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 09:39:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956422#M648725</guid>
      <dc:creator />
      <dc:date>2015-10-12T09:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Addmonths in script</title>
      <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956423#M648726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank's,&lt;BR /&gt; But I think this will not help since I need to calculate the dates for occurrence &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 09:42:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956423#M648726</guid>
      <dc:creator />
      <dc:date>2015-10-12T09:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Addmonths in script</title>
      <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956424#M648728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear peter ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Help me in obtaining this Its working on my local System but not on Test Instance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/thread/186354"&gt;Pivot Table Current and Previous Using above&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 09:54:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956424#M648728</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-12T09:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Addmonths in script</title>
      <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956425#M648729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if this is what you are looking for but this script will generate transactions for you within a timespan and one event for every 4 months. You can introduce a random factor to filter out events too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14446449774436531 jive_text_macro" jivemacro_uid="_14446449774436531"&gt;
&lt;P&gt;//Function to calculate Months Difference in script&lt;/P&gt;
&lt;P&gt;SET MonthDiff = Num(((year($2) * 12) + month($2)) - (((year($1) * 12) + month($1))) + 1);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;vStart = MakeDate( 2014, 1 , 1);&lt;/P&gt;
&lt;P&gt;vEnd = MakeDate( 2015, 6 , 30 );&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Months = Ceil( $(MonthDiff(vStart,vEnd)) / 4 );&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;TRANSACTIONS:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; *&lt;/P&gt;
&lt;P&gt;WHERE&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Rand()&amp;lt;0.5;&amp;nbsp;&amp;nbsp; // Filter out randomly 50% of the events - if you want ALL set it to &amp;lt;1&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TransID &amp;amp; '-' &amp;amp; IterNo() AS TransID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Date,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 'Event #' &amp;amp; IterNo() AS EventID&lt;/P&gt;
&lt;P&gt;WHILE&lt;/P&gt;
&lt;P&gt;&amp;nbsp; IterNo() &amp;lt; 10;&amp;nbsp;&amp;nbsp; // Generate 9 events for each month that comes from below&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; RecNo() AS TransID,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; AddMonths( '$(vStart)' , (RecNo()-1)*4 ) AS Date&lt;/P&gt;
&lt;P&gt;AUTOGENERATE&lt;/P&gt;
&lt;P&gt;&amp;nbsp; $(Months);&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 10:16:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956425#M648729</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2015-10-12T10:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Addmonths in script</title>
      <link>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956426#M648730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Petter&lt;/P&gt;&lt;P&gt;This solution will work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2015 10:50:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Addmonths-in-script/m-p/956426#M648730</guid>
      <dc:creator />
      <dc:date>2015-10-12T10:50:39Z</dc:date>
    </item>
  </channel>
</rss>

