<?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 Display Previous Month Values in Pivot Table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150252#M589905</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your fantastic reply jsn!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Jul 2009 15:52:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-07-27T15:52:10Z</dc:date>
    <item>
      <title>Display Previous Month Values in Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150248#M589900</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've searched the forums extensively for this topic which has been discussed at depth, and tried implementing the suggested formulas with little success.&lt;/P&gt;&lt;P&gt;Please see my pivot table below:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-340_sourceID:340" /&gt;&lt;/P&gt;&lt;P&gt;The user is required to select a Year and Month in list boxes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The formula for This Month is:&lt;/P&gt;&lt;P&gt;Sum(GLTranAmount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The formula for YTD (rolling financial year) is:&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Month =&amp;gt;} If(InYearToDate(GLTranDate, vMaxDate, 0, 7), GLTranAmount))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The formula for Last Year Total (static) is:&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;[FinYear]={$(=max([FinYear])-1)},Month=&amp;gt;} GLTranAmount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I best write the formula for Previous Month?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 08:20:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150248#M589900</guid>
      <dc:creator />
      <dc:date>2009-07-24T08:20:46Z</dc:date>
    </item>
    <item>
      <title>Display Previous Month Values in Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150249#M589901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;I assume you have some kind of Date/Timestamp field from which you've extracted the Years and Months into their own fields.&lt;/P&gt;&lt;P&gt;If you want to look at the previous month the easiest approach is to have a full date or something like YYYYMM and then use the function AddMonths.&lt;/P&gt;&lt;P&gt;AddMonths(Timestamp,-1)&lt;/P&gt;&lt;P&gt;This subtracts one month and you don't run into problems when going from Jan to Dec for example.&lt;/P&gt;&lt;P&gt;//Jsn&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 08:27:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150249#M589901</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-24T08:27:54Z</dc:date>
    </item>
    <item>
      <title>Display Previous Month Values in Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150250#M589902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;jsn:&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Month={$(=(AddMonths(max(GLTranDate,0),-1)))}&amp;gt;} GLTranAmount)&lt;/P&gt;&lt;P&gt;Along these lines? (not working)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 08:48:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150250#M589902</guid>
      <dc:creator />
      <dc:date>2009-07-24T08:48:23Z</dc:date>
    </item>
    <item>
      <title>Display Previous Month Values in Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150251#M589903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;First of all you can't just set the Month in the set analysis since if today is Jan and you want to look at the previous month you're also wrapping over to last year.&lt;/P&gt;&lt;P&gt;The quickest approach is likely to create a YearMonth field in the script. 200905, 200906 etc. and make sure it's formatted as a proper date.&lt;/P&gt;&lt;P&gt;Then you could apply:&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;YearMonth={$(=(AddMonths(YearMonth,-1)))}&amp;gt;} GLTranAmount)&lt;/P&gt;&lt;P&gt;This can of course be done on the fly in the expression and then applied on both Year and Month.. (beware of missing parentheses):&lt;/P&gt;&lt;P&gt;Sum({$&amp;lt;Month={$(=Month(AddMonths(date#(Year &amp;amp; Month,'YYYYMM'),-1)))}, Year={$(=Year(AddMonths(date#(Year &amp;amp; Month,'YYYYMM'),-1)))}&amp;gt;} GLTranAmount)&lt;/P&gt;&lt;P&gt;You might need a Num() around the month function too depending on if you use numeric or text format for display of your months.&lt;/P&gt;&lt;P&gt;I recommend going the script route as that makes it a whole let easier to maintain.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2009 17:09:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150251#M589903</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-24T17:09:25Z</dc:date>
    </item>
    <item>
      <title>Display Previous Month Values in Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150252#M589905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your fantastic reply jsn!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Jul 2009 15:52:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150252#M589905</guid>
      <dc:creator />
      <dc:date>2009-07-27T15:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Display Previous Month Values in Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150253#M589909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Johannes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry if I'm jumping into this topic but the formula that you posted may fit my needs however as I'm Qlik rookie I need your help to edit.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; line-height: 1.5em;"&gt;Sum({$&amp;lt;Month={$(=Month(AddMonths(date#(Year &amp;amp; Month,'YYYYMM'),-1)))}, Year={$(=Year(AddMonths(date#(Year &amp;amp; Month,'YYYYMM'),-1)))}&amp;gt;} GLTranAmount)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My table has both fields (YEAR and MONTH) in # format, hence if i'm not mistaken some formula parts can be deleted but I'm not sure which&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ciao&lt;/P&gt;&lt;P&gt;STEFANO&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Nov 2015 13:51:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Display-Previous-Month-Values-in-Pivot-Table/m-p/150253#M589909</guid>
      <dc:creator />
      <dc:date>2015-11-27T13:51:49Z</dc:date>
    </item>
  </channel>
</rss>

