<?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: Problem with Addmonths Function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304722#M112611</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Craig,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally when you reload all your selections are cleared unless you lock them. However this is not the problem you are having. What are the outputs for getselectedcount(Month) and date functions used in else part?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 Oct 2011 16:40:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-10-01T16:40:04Z</dc:date>
    <item>
      <title>Problem with Addmonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304721#M112610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recently put together an addmonths function for a prior month calculation (addmonths to enable me to cross years).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The formula worked great and then on a refresh no longer worked.&amp;nbsp; I will show you the steps I have taken.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The original formula which worked is below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if(getselectedcount(Month)=1 ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1*(sum({&amp;lt;Quarter=,Year=,Month=,MonthYear={"&amp;lt;=$(=Date(addmonths(Max(MonthYear),-1), 'MMM-YYYY'))"}&amp;gt;}Value)/$(vScale)),&lt;/P&gt;&lt;P&gt;1*(sum({&amp;lt;Quarter=,Year=,Month=,MonthYear={"&amp;gt;=$(=Date(addmonths(Max(MonthYear),-(2*getselectedcount(Month)-1)), 'MMM-YYYY'))&amp;lt;=$(=Date(addmonths(Max(MonthYear),-(getselectedcount(Month))), 'MMM-YYYY')) "}&amp;gt;}Value)/$(vScale))))&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;On the refresh nothing worked.&amp;nbsp; I ended up taking the "&amp;lt;=" out of the first line and getselectedcount(Month)=1 now works, but I still can't get the second part to work.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;I have no idea why these would work initially and then on a refresh not work, I have checked files and nothing seems to have changed.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;Any help or advice on the formulas above would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;﻿&lt;/SPAN&gt;Craig&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 14:01:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304721#M112610</guid>
      <dc:creator />
      <dc:date>2011-09-30T14:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Addmonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304722#M112611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Craig,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally when you reload all your selections are cleared unless you lock them. However this is not the problem you are having. What are the outputs for getselectedcount(Month) and date functions used in else part?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Oct 2011 16:40:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304722#M112611</guid>
      <dc:creator />
      <dc:date>2011-10-01T16:40:04Z</dc:date>
    </item>
    <item>
      <title>Problem with Addmonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304723#M112612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Craig,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;may I ask, what you want to achieve with something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MonthYear={"&amp;gt;=$(=Date(addmonths(Max(MonthYear),-(2*getselectedcount(Month)-1)), 'MMM-YYYY'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you select nothing in MonthYear, getselectedcount will be zero, and the second parameter will be +1, addmonths will then try to access a date in the future, outside your current selection (max(MonthYear)+1), you will get no result then, I believe.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you select more than 1 value, you are going 3, 5, 7, 9 .. Months back in time, is that what you want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Oct 2011 12:37:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304723#M112612</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-10-02T12:37:07Z</dc:date>
    </item>
    <item>
      <title>Problem with Addmonths Function</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304724#M112613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the formula I shared was actually the alternative to If(getselectedcount(Month)=0, which would take care of your first issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did find out what happened.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I separated the formula to work on it it was on separate lines &lt;/P&gt;&lt;P&gt;ie:&lt;/P&gt;&lt;P&gt;&amp;lt;= x&lt;/P&gt;&lt;P&gt;&amp;gt;=y&lt;/P&gt;&lt;P&gt;and this worked in my copy, but on the refresh it broke, but when i put it all on one line &amp;lt;=x &amp;gt;=y it worked again.&amp;nbsp; A simple solution--I didnt realize a refresh would change how QV would read a formula.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2011 18:24:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Addmonths-Function/m-p/304724#M112613</guid>
      <dc:creator />
      <dc:date>2011-10-03T18:24:23Z</dc:date>
    </item>
  </channel>
</rss>

