<?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: Comparision vs. Previous Period in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454384#M486791</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached qvw&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Feb 2013 12:05:27 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-02-20T12:05:27Z</dc:date>
    <item>
      <title>Comparision vs. Previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454383#M486790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's an issue in my Qv document when I compare Current Period Sales vs. Previous Period Sales in some corner cases where my solution (simple and straightforward) doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current Period may be selected by the user freely and may be non-contiguous dates, YTD, and even contiguous dates across two consecutive years mainly for &lt;/P&gt;&lt;P&gt;&lt;SPAN class="st"&gt;moving &lt;EM&gt;annual&lt;/EM&gt; total (MAT). &lt;/SPAN&gt;&lt;SPAN class="st"&gt;Loaded data in the complete model goes from 2009 to 2012.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="st"&gt;My solution involves creating a calendar (granularity up to months, not days) where I add a dimension called 'Previous Year&amp;amp;Month' whose value is exactly 12 months before current date. This way I tie current date to 12-months-before date.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="st"&gt;And when I want to get sum(Sales) from previous period (not always a 12 months period nor even same months from previous year) the expresion is quite simple: sum({$&amp;lt;CURRENT_YEAR_MONTH=P(PREVIOUS_YEAR_MONTH),CURRENT_YEAR=,CURRENT_MONTH=&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="st"&gt;It works perfectly if data from ALL current period exist ut if we have "holes" in some months where some data exist from previous period, then data from previous period don't get included in sum() and results from previous period is wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="st"&gt;I've tried different approaches to solve this issue: From using 'getfieldselection' in p() (not very elegant and forces to use 'replace' in my expressions catalog in the script to avoid $-expansion annoyances) to 'selectively unselect' dimensions in set analysis '&amp;lt;...DIMENSION=,...&amp;gt;' but it may be quite a mess if there's too many dimensions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One of my constraints is that I want the user use only year selector and month selector to select months &amp;amp; year (TAM is indirectely selected through button --&amp;gt; then correct year&amp;amp;month data range is automatically calculated, so user doesn't have direct access to year&amp;amp;month concatenated dimension)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="st"&gt;Any idea?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a simple example which illustrates the problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="st"&gt;Thanks in advance,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="st"&gt;&amp;nbsp; Raúl&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 11:51:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454383#M486790</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-20T11:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision vs. Previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454384#M486791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached qvw&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 12:05:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454384#M486791</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-02-20T12:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision vs. Previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454385#M486792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raúl,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have think on two possible solutions. One based on Set Analysis and other with an isolated table for month selections. Attached my example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Juan Gerardo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 12:35:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454385#M486792</guid>
      <dc:creator />
      <dc:date>2013-02-20T12:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision vs. Previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454386#M486793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Juan Gerardo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick response!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've checked your solution and &lt;STRONG&gt;it works Ok in the example&lt;/STRONG&gt; using one of the approaches I pointed out in my original post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem here is that if you have many dimension which may be selected by the user, it may be a mess excluding them all from all the set analysis expressions in the document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could it exist another solution (maybe using data island) which doesn't involve cluttered set analysis expressions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Raúl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 12:49:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454386#M486793</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-20T12:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision vs. Previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454387#M486795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, but I think your example is not working properly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When using 'Alice' &amp;amp; 'Shirts' filter and year is set to 2012, previous sales are 2.266,00€. But when I select 2011, current sales are 3.170,00€ (correct value)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks anyway for your answer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Raúl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 12:56:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454387#M486795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-20T12:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision vs. Previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454388#M486797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I thought you wanted to compare the same months. Apparently you do not. So try =Sum({$&amp;lt;YEAR={$(=max(YEAR)-1)}&amp;gt;}SALES)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 13:02:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454388#M486797</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-02-20T13:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision vs. Previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454389#M486799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, what I want is keep the time period I originally selected (even if some of the months are excluded by filtering of other dimensions) and shift it 12 months backwards to calculate sum(Sales).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried your solution and it works as long as the months I select are from the same year. If I try to select a range of months from -let's say- nov-11 to july-12 using YEAR_MONTH dimension, it fails.&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;&amp;nbsp; Raúl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 13:39:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454389#M486799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-20T13:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Comparision vs. Previous Period</title>
      <link>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454390#M486800</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 just wanted to point out an elegant solution to my problem that I found while surfing the Internet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://qlikfit.blogspot.com.es/2014/07/set-analysis-that-ignores-all.html" title="http://qlikfit.blogspot.com.es/2014/07/set-analysis-that-ignores-all.html"&gt;QlikFit: Set analysis that ignores all selections except a few&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Raúl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2015 08:13:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparision-vs-Previous-Period/m-p/454390#M486800</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-23T08:13:26Z</dc:date>
    </item>
  </channel>
</rss>

