<?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: Strange behaviour with AddMonths Function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323245#M409690</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be using AddYears()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;AddMonths(FactDateNum,-1) as PrevMonth,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;AddYEars(FactDateNum,-1) as PrevYear&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Apr 2017 12:21:26 GMT</pubDate>
    <dc:creator>vinieme12</dc:creator>
    <dc:date>2017-04-26T12:21:26Z</dc:date>
    <item>
      <title>Strange behaviour with AddMonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323242#M409687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Qlikview user&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am creating 2 fields in my script which creates two dates for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AddMonths(FactDateNum,-1) as PrevMonth,&lt;/P&gt;&lt;P&gt;AddMonths(FactDateNum,-12) as PrevYear&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FactDateNum is created by the following equation:&lt;/P&gt;&lt;P&gt;num(Floor(CLOCK_STOP_OR_SNAPSHOT)) as FactDateNum&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use Aug-16 as an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;PrevYear&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;AddMonths(FactDateNum,-12) as PrevYear&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Will return a values of &lt;STRONG&gt;31/08/2015&lt;/STRONG&gt; - Which is the desired result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;PrevMonth&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;AddMonths(FactDateNum,-1) as PrevMonth&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If a user selects Sep-16 - then this field displays &lt;STRONG&gt;30/08/2016.&amp;nbsp; &lt;/STRONG&gt;I cannot understand where the 31/08/2016 has gone too, if PrevYear is able to display the final day in the month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought my dataset may be wrong, but the fact that PrevYear can return a value of 31/08 I wonder if my expression is an issue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Helen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:17:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323242#M409687</guid>
      <dc:creator>helen_pip</dc:creator>
      <dc:date>2017-04-26T12:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour with AddMonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323243#M409688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;Date(Floor(&lt;SPAN style="color: #ff0000;"&gt;MonthEnd&lt;/SPAN&gt;(FactDateNum, -1))) as PrevMonth,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Date(Floor(&lt;SPAN style="color: #ff0000;"&gt;MonthEnd&lt;/SPAN&gt;(&lt;/SPAN&gt;FactDateNum, -12))) as PrevYear&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:20:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323243#M409688</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-04-26T12:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour with AddMonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323244#M409689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;DayName(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;MonthEnd&lt;/SPAN&gt;(FactDateNum, -1)) as PrevMonth,&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;STRONG style="color: #3d3d3d; font-family: inherit; font-size: 13.3333px; font-style: inherit;"&gt;DayName&lt;/STRONG&gt;(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #ff0000;"&gt;MonthEnd&lt;/SPAN&gt;(&lt;/SPAN&gt;FactDateNum, -12)) as PrevYear&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:21:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323244#M409689</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-04-26T12:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour with AddMonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323245#M409690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should be using AddYears()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;AddMonths(FactDateNum,-1) as PrevMonth,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;AddYEars(FactDateNum,-1) as PrevYear&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:21:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323245#M409690</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2017-04-26T12:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour with AddMonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323246#M409691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using optional mode =1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;A name="kanchor481"&gt;&lt;/A&gt;&lt;A name="AddMonths"&gt;&lt;/A&gt;&lt;SPAN class="Bold"&gt;AddMonths(&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;startdate&lt;/SPAN&gt;, &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; , &lt;SPAN class="Italic"&gt;&lt;STRONG&gt;[ , mode] &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Returns the date occurring &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; months after &lt;SPAN class="Italic"&gt;startdate&lt;/SPAN&gt; or, if &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; is negative, the date occurring &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; months before &lt;SPAN class="Italic"&gt;startdate&lt;/SPAN&gt;. &lt;/P&gt;&lt;P&gt;By specifying a &lt;SPAN class="Italic"&gt;mode&lt;/SPAN&gt; (0 if omitted) the date is set to either the unmodified day of the specified month (&lt;SPAN class="Italic"&gt;mode&lt;/SPAN&gt;=0) or the calculated day as derived from the end of the month (&lt;SPAN class="Italic"&gt;mode&lt;/SPAN&gt;=1). &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:22:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323246#M409691</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2017-04-26T12:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behaviour with AddMonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323247#M409692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sunny&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has worked for me, as I realise that I was counting back 30 days from September which resulted in 30/08/2016&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Helen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Apr 2017 12:24:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behaviour-with-AddMonths-Function/m-p/1323247#M409692</guid>
      <dc:creator>helen_pip</dc:creator>
      <dc:date>2017-04-26T12:24:30Z</dc:date>
    </item>
  </channel>
</rss>

