<?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: Calculate sales for last N months in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764511#M1033904</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see attached rolling months example. courtesy of &lt;SPAN style="font-size: 9.0pt; font-family: 'inherit','serif'; color: #8b8b8b;"&gt;&lt;A href="http://community.qlikview.com/people/gwassenaar"&gt;&lt;SPAN style="color: #8ca9cd;"&gt;Gysbert Wassenaar&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt; &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jan 2015 15:52:27 GMT</pubDate>
    <dc:creator>giakoum</dc:creator>
    <dc:date>2015-01-26T15:52:27Z</dc:date>
    <item>
      <title>Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764507#M1033897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I have a variable created to calculate the number of months back from which I need to calculate the sales.I also have sales listed by months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, if n is 6, I need to calculate the sales from july 2014.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried several expressions but unable to seem to get it right. Can someone please help ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 01:35:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764507#M1033897</guid>
      <dc:creator />
      <dc:date>2015-01-26T01:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764508#M1033899</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;try the below expression,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;orderdate={'&amp;gt;=$(vMonth)'}&amp;gt;}Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are couple of things you need to follow when using date in set analysis...&lt;/P&gt;&lt;P&gt;keep the date in number format when you are storing the value in variable. Otherwise it will consider it as string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please upload a sample application if you couldn't achieve it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhu Appu &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 05:00:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764508#M1033899</guid>
      <dc:creator>prabhuappu</dc:creator>
      <dc:date>2015-01-26T05:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764509#M1033901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prabhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried your solution and did not work.I have a master calendar set up. The date is in yyyymm format. And the variable vMonth is an integer ( like 6 , if I need to calculate from six months ago)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 15:38:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764509#M1033901</guid>
      <dc:creator />
      <dc:date>2015-01-26T15:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764510#M1033903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if n is a variable/field which selects your current month, then you can have an expression as below:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;n={"&amp;gt;=$(=max(n)-6)&amp;lt;=$(=max(n))"}&amp;gt;}sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 15:49:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764510#M1033903</guid>
      <dc:creator>saurabh5</dc:creator>
      <dc:date>2015-01-26T15:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764511#M1033904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see attached rolling months example. courtesy of &lt;SPAN style="font-size: 9.0pt; font-family: 'inherit','serif'; color: #8b8b8b;"&gt;&lt;A href="http://community.qlikview.com/people/gwassenaar"&gt;&lt;SPAN style="color: #8ca9cd;"&gt;Gysbert Wassenaar&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt; &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 15:52:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764511#M1033904</guid>
      <dc:creator>giakoum</dc:creator>
      <dc:date>2015-01-26T15:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764512#M1033905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried something along these lines?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(if([DATEVALUE] &amp;gt; AddMonths(today(1),[VARIABLE]*-1),[SALESAMOUNT],0))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 16:12:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764512#M1033905</guid>
      <dc:creator />
      <dc:date>2015-01-26T16:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764513#M1033906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And if you want to include data from the start of that month, see below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=sum(if([DATEVALUE] &amp;gt; monthstart(AddMonths(today(1),[VARIABLE]*-1)),[SALESAMOUNT],0))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 16:13:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764513#M1033906</guid>
      <dc:creator />
      <dc:date>2015-01-26T16:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764514#M1033907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravichandran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of storing month alone in a variable, store both YearMonth in it. You can use the below expression to Calculate YearMonth value of previous 6th month,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;date(MonthStart(Date#('201205','YYYYMM'),-6),'YYYYMM')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace '201205' with your max(Date) value ($(=max(Date))). Since you have the date in YYYYMM format, max(Date) will return the current month or Max of month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use that variable in your set analysis as &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;sum({&amp;lt;Date={'&amp;gt;=$(vMonth)'}&amp;gt;}Sales)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please attach a sample, so that we can understand the problem that you are facing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhu Appu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 16:22:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764514#M1033907</guid>
      <dc:creator>prabhuappu</dc:creator>
      <dc:date>2015-01-26T16:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764515#M1033908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for helping me. I managed to get it work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2015 17:32:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764515#M1033908</guid>
      <dc:creator />
      <dc:date>2015-01-26T17:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764516#M1033909</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;I use the following expression, but there is a problem, when I select Month=2, the result only show which belong to Month 2, not the rolling result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vBegin=Num(date(Addmonths(Date#(Max(MonthKey),'YYYYMM'),-11),'YYYYMMDD'),'#,##0')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vEnd=Num(Date(Max(DateDate),'YYYYMMDD'),'#,##0')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count({&amp;lt;Month={$(vCurrentMonth)},Key={"&amp;lt;=$(vEnd)&amp;gt;=$(vBegin)"}&amp;gt;}Machine)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Feb 2016 05:04:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764516#M1033909</guid>
      <dc:creator />
      <dc:date>2016-02-24T05:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764517#M1033910</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;I use the following expression, but there is a problem, when I select Month=2, the result only show which belong to Month 2, not the rolling result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vBegin=Num(date(Addmonths(Date#(Max(MonthKey),'YYYYMM'),-11),'YYYYMMDD'),'#,##0')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vEnd=Num(Date(Max(DateDate),'YYYYMMDD'),'#,##0')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count({&amp;lt;Month={$(vCurrentMonth)},Key={"&amp;lt;=$(vEnd)&amp;gt;=$(vBegin)"}&amp;gt;}Machine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Feb 2016 05:05:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764517#M1033910</guid>
      <dc:creator />
      <dc:date>2016-02-24T05:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate sales for last N months</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764518#M1033911</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;Try changing the variable expression as below. Omitted the month selection from calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;vBegin=Num(date(Addmonths(Date#(Max(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #f2f2f2;"&gt;&lt;STRONG&gt;&lt;EM&gt;{&amp;lt;Month=&amp;gt;}&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;MonthKey),'YYYYMM'),-11),'YYYYMMDD'),'#,##0')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;vEnd=Num(Date(Max(&lt;STRONG&gt;&lt;EM&gt;{&amp;lt;Month=&amp;gt;}&lt;/EM&gt;&lt;/STRONG&gt;DateDate),'YYYYMMDD'),'#,##0')&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;Regards,&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;Prabhu Appu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 10:28:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-sales-for-last-N-months/m-p/764518#M1033911</guid>
      <dc:creator>prabhuappu</dc:creator>
      <dc:date>2016-03-03T10:28:38Z</dc:date>
    </item>
  </channel>
</rss>

