<?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: 12 Month Lookback in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448323#M487679</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, it's a date. Try MTHSTART={'$(=addmonths($(vMaxMonth),-1))'}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jan 2013 15:00:35 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-01-23T15:00:35Z</dc:date>
    <item>
      <title>12 Month Lookback</title>
      <link>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448320#M487676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I'm working on a Financial Dashboard for our company that will be providing Profit and Loss statements verses printing out a huge stack of paper P&amp;amp;L statements.&amp;nbsp; One of the requests was to have a 12 month lookback with an P&amp;amp;L statement for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;P&amp;amp; L Heading&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Jan 2013&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;December 2012&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;November 2012&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;LINE HAUL REVENUE&lt;/TD&gt;&lt;TD&gt;$1234.00&lt;/TD&gt;&lt;TD&gt;$1222.00&lt;/TD&gt;&lt;TD&gt;$1423.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ACCESSORIAL REVENUE&lt;/TD&gt;&lt;TD&gt;$300.00&lt;/TD&gt;&lt;TD&gt;$200.00&lt;/TD&gt;&lt;TD&gt;$600.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;TOTAL REVENUE&lt;/TD&gt;&lt;TD&gt;$1534.00&lt;/TD&gt;&lt;TD&gt;$1422.00&lt;/TD&gt;&lt;TD&gt;$2023&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I already have a tab that shows the P&amp;amp;L Headings with the current month but I'm having trouble with the 12 month lookback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my dimension is P&amp;amp;L Heading and my first expression is this (which works):&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13589516196792080" jivemacro_uid="_13589516196792080"&gt;&lt;P&gt;Sum({&amp;lt;PL_LineType={'e'},MTHSTART={'=$(vMaxMonth)'}&amp;gt;} [Amount])+Sum({&amp;lt;PL_LineType={'i'},MTHSTART={'=$(vMaxMonth)'}&amp;gt;} [Amount]*-1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Where vMaxMonth is =max(MTHSTART). (PL_Linetype is P&amp;amp;L Headings that match 'e' are expenses and 'i' are income lines.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So how would I go programming the second expression with 1 month less than the selected one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 14:32:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448320#M487676</guid>
      <dc:creator />
      <dc:date>2013-01-23T14:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: 12 Month Lookback</title>
      <link>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448321#M487677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your month is a numeric field then this should work: MTHSTART={'=$(vMaxMonth)-1'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a date field you should look into using Qlikview Components. It can create a master calendar for you with a lot of pre-built set expressions that make working with dates and periods a whole lot easier (not to mention less painful). See &lt;A _jive_internal="true" href="https://community.qlik.com/thread/66717"&gt;here&lt;/A&gt; for more information.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 14:42:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448321#M487677</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-01-23T14:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: 12 Month Lookback</title>
      <link>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448322#M487678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried it and no luck!&amp;nbsp; I think that vMaxMonth is a date field, this is what is in the variable for me at the moment: 1/1/2013&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 14:46:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448322#M487678</guid>
      <dc:creator />
      <dc:date>2013-01-23T14:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: 12 Month Lookback</title>
      <link>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448323#M487679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, it's a date. Try MTHSTART={'$(=addmonths($(vMaxMonth),-1))'}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 15:00:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448323#M487679</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-01-23T15:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: 12 Month Lookback</title>
      <link>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448324#M487680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's it! I used that along with ignoring some values via set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help Gysbert!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2013 20:12:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/12-Month-Lookback/m-p/448324#M487680</guid>
      <dc:creator />
      <dc:date>2013-01-23T20:12:49Z</dc:date>
    </item>
  </channel>
</rss>

