<?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: Forcing the Set analysis Context in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941565#M324630</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, you cannot do this with Set Analysis. The Set Analysis is like a selection that is made &lt;EM&gt;before&lt;/EM&gt; all the cells of the table are evaluated, and you want the evaluation to be different for different years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would do it in the script. You could for example add the following lines after your loaded table (named tmp):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If(Product=Peek(Product),0,1) as IsNew&lt;/P&gt;&lt;P&gt;&amp;nbsp; Resident tmp&lt;/P&gt;&lt;P&gt;&amp;nbsp; Order By Product, Year ;&lt;/P&gt;&lt;P&gt;Drop Table tmp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Oct 2015 17:29:36 GMT</pubDate>
    <dc:creator>hic</dc:creator>
    <dc:date>2015-10-21T17:29:36Z</dc:date>
    <item>
      <title>Forcing the Set analysis Context</title>
      <link>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941564#M324629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Please find attached a QlikView app that illustrate my question.&lt;/P&gt;&lt;P&gt;I am trying to get the count of the new products that appeared in one year compared to previous one.&lt;/P&gt;&lt;P&gt;My expression works well for this two years (2011, 2010)&amp;nbsp; because it hard coded &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt; :&lt;/P&gt;&lt;P&gt;Count( DISTINCT {$ &amp;lt; Product= P({&amp;lt;Year={'2011'}&amp;gt;} Product)- P({&amp;lt;Year={'2010'} &amp;gt;} Product)&amp;gt;} Product)&lt;/P&gt;&lt;P&gt;How can we use it for every values? Something like : Count( DISTINCT {$ &amp;lt; Product= P({&amp;lt;Year={'$(=Max(Year))'}&amp;gt;} Product)- P({&amp;lt;Year={'$(=Max(Year)-1)'} &amp;gt;} Product)&amp;gt;} Product)? In The &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Set analysis Max(Year) always return 2012 even if i have the year as dimension included in the chart!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;In my case it is impossible to use Above()..&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thank you for help. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Oct 2015 16:16:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941564#M324629</guid>
      <dc:creator />
      <dc:date>2015-10-21T16:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing the Set analysis Context</title>
      <link>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941565#M324630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, you cannot do this with Set Analysis. The Set Analysis is like a selection that is made &lt;EM&gt;before&lt;/EM&gt; all the cells of the table are evaluated, and you want the evaluation to be different for different years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would do it in the script. You could for example add the following lines after your loaded table (named tmp):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If(Product=Peek(Product),0,1) as IsNew&lt;/P&gt;&lt;P&gt;&amp;nbsp; Resident tmp&lt;/P&gt;&lt;P&gt;&amp;nbsp; Order By Product, Year ;&lt;/P&gt;&lt;P&gt;Drop Table tmp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Oct 2015 17:29:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941565#M324630</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2015-10-21T17:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing the Set analysis Context</title>
      <link>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941566#M324631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very very challenging..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;Before I came&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;to this&lt;/SPAN&gt;, I had already &lt;SPAN class="hps"&gt;given up&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;twice:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14454569729537716" jivemacro_uid="_14454569729537716"&gt;
&lt;P&gt;SubStringCount(Concat(Aggr(Product &amp;amp; ':' &amp;amp; Concat(DISTINCT&amp;nbsp; Year, ','), Product), '/'), ':')&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See attached..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to think twice the corner &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/devil.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Ralf&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: this reminds me on the "old" basket analysis problem which could probably solved with this approach &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/cool.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Oct 2015 19:52:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941566#M324631</guid>
      <dc:creator>rbecher</dc:creator>
      <dc:date>2015-10-21T19:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing the Set analysis Context</title>
      <link>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941567#M324632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Henric,&lt;/P&gt;&lt;P&gt;Thanks a lot for your reply, but unfortunaly this very clean solution doesn't work in my case because&amp;nbsp; my result depends on the selections that i could have, ex a new product for my customer 1, is not the same for another one. So the solution if it exists have to be on the display not in the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you Henric, i hope that you'll have another suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hamid.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Oct 2015 09:00:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941567#M324632</guid>
      <dc:creator />
      <dc:date>2015-10-22T09:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing the Set analysis Context</title>
      <link>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941568#M324633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ralf,&lt;/P&gt;&lt;P&gt;Yes a very big challenge this's why i went to catch the best &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; &lt;/P&gt;&lt;P&gt;I spent 2h to understand your solution, it looks very smart but difficult to understand.&lt;/P&gt;&lt;P&gt;Why does the Concat Product year take only the new one year by year? &lt;/P&gt;&lt;P&gt; A) May be because of the 'Distinct' parameter --&amp;gt; No because i droped it and i got the same result&lt;/P&gt;&lt;P&gt;B) Maybe Because of the Magical and Unpredictable Aggr ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have saw that in the example that you sent, you missed P2 as new in 2013, beacause he appeared in 2010, we lost it in 2012 and he reappeared in 2013 &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; so it's a new product&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i doubt that i can readapte this solution for my other case, so i need to count the Lost too &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt; no luck&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you'll find a time to reply me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hamid. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Oct 2015 09:14:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941568#M324633</guid>
      <dc:creator />
      <dc:date>2015-10-22T09:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Forcing the Set analysis Context</title>
      <link>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941569#M324634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;Disclaimer: In advance I'm apologizing for the ugliness of the solution. Sometimes you need to do what you do for the sake of having a solution&lt;/EM&gt; &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Below solution requires some yearly maintenance. If anyone has an idea to make it better, I'd be very happy to get it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are the formulas I've used to make it work:&lt;/P&gt;&lt;P&gt;* Joiners:&lt;/P&gt;&lt;P&gt;If (Year_QVW=2013,Count( DISTINCT {$ &amp;lt; DPN= P({&amp;lt;Year_QVW={'2013'}&amp;gt;} DPN)- P({&amp;lt;Year_QVW={'2012'}&amp;gt;} DPN)&amp;gt;} DPN),&lt;/P&gt;&lt;P&gt;If (Year_QVW=2014,Count( DISTINCT {$ &amp;lt; DPN= P({&amp;lt;Year_QVW={'2014'}&amp;gt;} DPN)- P({&amp;lt;Year_QVW={'2013'}&amp;gt;} DPN)&amp;gt;} DPN),&lt;/P&gt;&lt;P&gt;If (Year_QVW=2015,Count( DISTINCT {$ &amp;lt; DPN= P({&amp;lt;Year_QVW={'2015'}&amp;gt;} DPN)- P({&amp;lt;Year_QVW={'2014'}&amp;gt;} DPN)&amp;gt;} DPN),&lt;/P&gt;&lt;P&gt;0)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Leavers:&lt;/P&gt;&lt;P&gt;If (Year_QVW=2012,Count( DISTINCT {$ &amp;lt; DPN= P({&amp;lt;Year_QVW={'2012'}&amp;gt;} DPN)- P({&amp;lt;Year_QVW={'2013'}&amp;gt;} DPN)&amp;gt;} DPN),&lt;/P&gt;&lt;P&gt;If (Year_QVW=2013,Count( DISTINCT {$ &amp;lt; DPN= P({&amp;lt;Year_QVW={'2013'}&amp;gt;} DPN)- P({&amp;lt;Year_QVW={'2014'}&amp;gt;} DPN)&amp;gt;} DPN),&lt;/P&gt;&lt;P&gt;If (Year_QVW=2014,Count( DISTINCT {$ &amp;lt; DPN= P({&amp;lt;Year_QVW={'2014'}&amp;gt;} DPN)- P({&amp;lt;Year_QVW={'2015'}&amp;gt;} DPN)&amp;gt;} DPN),&lt;/P&gt;&lt;P&gt;0)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/106176_pastedImage_2.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;Christophe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2015 07:48:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Forcing-the-Set-analysis-Context/m-p/941569#M324634</guid>
      <dc:creator>cleblois</dc:creator>
      <dc:date>2015-11-20T07:48:51Z</dc:date>
    </item>
  </channel>
</rss>

