<?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 MonthsAgo not working as expected in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614035#M683087</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use a Master Calendar which has the line to create&amp;nbsp; MonthsAgo &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;12*(Year(Today())-Year(TempDate))+Month(Today))-Month(TempDate) as MonthsAgo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I use the expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({$&amp;lt;MonthsAgo{'&amp;gt;=6&amp;lt;=12'}&amp;gt;}Sales) &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both work as you would expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use Nprinting and want to apply a filter using 'MonthsAgo' and have found it doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To investigate the problem&amp;nbsp; I have all of my dates (Months, Years, MonthsAgo etc) in list boxes and select say 2014 from Year - I see MonthsAgo correctly selected and my tables change to only show the associated date range. If I select a range of dates from the months ago list box&amp;nbsp; the related dates change in the list boxes but my charts and tables are not affected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help with this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Feb 2014 17:01:40 GMT</pubDate>
    <dc:creator>pauledrich</dc:creator>
    <dc:date>2014-02-20T17:01:40Z</dc:date>
    <item>
      <title>MonthsAgo not working as expected</title>
      <link>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614035#M683087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use a Master Calendar which has the line to create&amp;nbsp; MonthsAgo &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;12*(Year(Today())-Year(TempDate))+Month(Today))-Month(TempDate) as MonthsAgo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I use the expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({$&amp;lt;MonthsAgo{'&amp;gt;=6&amp;lt;=12'}&amp;gt;}Sales) &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both work as you would expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use Nprinting and want to apply a filter using 'MonthsAgo' and have found it doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To investigate the problem&amp;nbsp; I have all of my dates (Months, Years, MonthsAgo etc) in list boxes and select say 2014 from Year - I see MonthsAgo correctly selected and my tables change to only show the associated date range. If I select a range of dates from the months ago list box&amp;nbsp; the related dates change in the list boxes but my charts and tables are not affected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help with this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 17:01:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614035#M683087</guid>
      <dc:creator>pauledrich</dc:creator>
      <dc:date>2014-02-20T17:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: MonthsAgo not working as expected</title>
      <link>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614036#M683088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum({$&amp;lt;MonthsAgo{'&amp;gt;=6&amp;lt;=12'}&amp;gt;}Sales)&lt;/STRONG&gt; means apply all selections except the selection in MonthsAgo and instead use only the MonthsAgo values larger or equal to 6 and smaller or equal to 12. If you don't want to overrule the selection in MonthsAgo you need to change the expression so &lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum(Sales)&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 19:12:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614036#M683088</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-02-20T19:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: MonthsAgo not working as expected</title>
      <link>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614037#M683089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paul, As Gysbert stated above, the set analysis ignore the SET Modifiers selections. If you need to apply the MonthAgo selections you need to re write your expression like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF( GETSELECTEDCOUNT(MonthAgo) = 0 , Sum({$&amp;lt;MonthsAgo{'&amp;gt;=6&amp;lt;=12'}&amp;gt;}Sales) , Sum(Sales) )&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above expression, if you make any selections on &lt;STRONG&gt;MonthsAgo&lt;/STRONG&gt; Sum(Sales) will be calculated otherwise your original expression will be calculated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Feb 2014 00:15:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614037#M683089</guid>
      <dc:creator />
      <dc:date>2014-02-22T00:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: MonthsAgo not working as expected</title>
      <link>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614038#M683091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for both replies very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand the syntax and I have not given the best explanation. My dimension is MonthName' MMM/YYYY' for my pivot table which for reporting purposes I only want the last 13 months including the most recent Month displayed;&amp;nbsp; as an example I have 'Sum({$&amp;lt;MonthsAgo={'&amp;gt;=0&amp;lt;=13'}&amp;gt;}Sales)' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use a list box for MonthName and only select say Dec2013 - the pivot changes and&amp;nbsp; only shows that one month, if I however select '2' from Months ago - I see the Year&amp;nbsp; selector change to '2013' and Months to 'December' with no change to the pivot table, clearly the addition of months ago in the expression causes the issue as I applied the calculation provided by dathu which works and makes sense, but also means I need to now change all expressions in all the dashboards which I really would like to avoid, so I have created the following script line which works well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(TempDate&amp;gt;=MonthStart(AddMonths($(vToday),-13)) AND TempDate&amp;lt;MonthStart($(vToday)-1),1,0) as ReportFlag&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can now create a Variable and apply the filter in Nprinting to only show the selected period, without the need to change 100's of expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However - I can see there being a need to simply apply as a bookmark across all dashboards and to have this refresh, daily or on opening. Is this easily achieved?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 13:00:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/MonthsAgo-not-working-as-expected/m-p/614038#M683091</guid>
      <dc:creator>pauledrich</dc:creator>
      <dc:date>2014-02-24T13:00:02Z</dc:date>
    </item>
  </channel>
</rss>

