<?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 Set Analysis Intersect in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354263#M131485</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;following Stefan's idea you could do something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a variable, name it vSET. Variable value should be&lt;/P&gt;&lt;P&gt;='p({&amp;lt;Year={' &amp;amp; concat(distinct Year,'}&amp;gt;})*p({&amp;lt;Year={') &amp;amp; '}&amp;gt;})'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then your expression should be&lt;/P&gt;&lt;P&gt;=count({&amp;lt;PersonKey=$(vSET)&amp;gt;}&amp;nbsp; distinct PersonKey)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will cause the set analysis expression to change when the year selection changes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie. 2007, 2008, 2009, 2010 selected&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;PersonKey=p({&amp;lt;Year={2007}&amp;gt;})*p({&amp;lt;Year={2008}&amp;gt;})*p({&amp;lt;Year={2009}&amp;gt;})*p({&amp;lt;Year={2010}&amp;gt;})&amp;gt;}&amp;nbsp; distinct PersonKey)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie. 2007, 2009, 2010 selected&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;PersonKey=p({&amp;lt;Year={2007}&amp;gt;})*p({&amp;lt;Year={2009}&amp;gt;})*p({&amp;lt;Year={2010}&amp;gt;})&amp;gt;}&amp;nbsp; distinct PersonKey)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Apr 2012 23:19:25 GMT</pubDate>
    <dc:creator>danielrozental</dc:creator>
    <dc:date>2012-04-16T23:19:25Z</dc:date>
    <item>
      <title>Set Analysis Intersect</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354256#M131478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm have counts of that where I am trying to get an intersection or cohort of all persons in each year.&amp;nbsp; I would like it to be flexible enough to be able to select more then two years.&amp;nbsp; In some cases in which I have data I need a five year cohort.&amp;nbsp; I'm really not find a good resource for documentation on Set Analysis.&amp;nbsp; I have a PDF from a set analysis course, however, I'm just not getting the syntax correct or something.&amp;nbsp; This, of course, is giving me the result of multiplying the two counts together and not the intersection.&amp;nbsp; Essentially, I want only people who belong to both years and how to code it for any number of years selected. Any advice would be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;= Count( { $&amp;lt; Year ={'2010'} &amp;gt;} Distinct PersonKey) * Count( { $&amp;lt; Year ={'2011'} &amp;gt;} Distinct PersonKey)&lt;/STRONG&gt;&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>Mon, 16 Apr 2012 19:14:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354256#M131478</guid>
      <dc:creator />
      <dc:date>2012-04-16T19:14:09Z</dc:date>
    </item>
    <item>
      <title>Set Analysis Intersect</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354257#M131479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With two values, try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #eef4f9; font-size: 12px; color: #636363; font-family: Arial;"&gt;= Count( { $&amp;lt; Year ={'2010'} &amp;gt;*&amp;lt; Year ={'2011'} &amp;gt;} Distinct PersonKey)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-size: 12px; font-family: Arial;"&gt;But have you tried an and-mode selection list box? Check the Help for that.&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 19:23:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354257#M131479</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-04-16T19:23:03Z</dc:date>
    </item>
    <item>
      <title>Set Analysis Intersect</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354258#M131480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can get a return number for each set separately, however, when combining them into the statement above it returns zero.&amp;nbsp; I cannot use and-mode because it is not available.&amp;nbsp; According to my research my Year field does not meet the requirements to use and-mode.&amp;nbsp; Any other suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 19:30:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354258#M131480</guid>
      <dc:creator />
      <dc:date>2012-04-16T19:30:19Z</dc:date>
    </item>
    <item>
      <title>Set Analysis Intersect</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354259#M131481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hm, need to rethink above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the meantime, this should work:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=count({&amp;lt;PersonKey =p( {&amp;lt;Year={2011}&amp;gt;})*p({&amp;lt;Year= {2012}&amp;gt;})&amp;gt;}&amp;nbsp; distinct PersonKey)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And yes, you need to fulfill some requirements to get an and-mode list-box working. Maybe it's possible to extend/change your data model?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 19:45:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354259#M131481</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-04-16T19:45:21Z</dc:date>
    </item>
    <item>
      <title>Set Analysis Intersect</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354260#M131482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That actually works and the numbers check out.&amp;nbsp; My next issues is how do I make that more dynamic? I want to be able to select multiple years and have it count only where the PersonKey is in every year.&amp;nbsp; I modified the code as follows which is great for just two years but I'm not sure how to do 3 or more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count({&amp;lt;PersonKey =p( {&amp;lt;Year={$(=Min(Year))}&amp;gt;})*p({&amp;lt;Year= {$(=Max(Year))}&amp;gt;})&amp;gt;}&amp;nbsp; distinct PersonKey)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp; I really appreciate the expertise!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 20:13:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354260#M131482</guid>
      <dc:creator />
      <dc:date>2012-04-16T20:13:50Z</dc:date>
    </item>
    <item>
      <title>Set Analysis Intersect</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354261#M131483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IMHO, your last expression will just return the PersonKeys that appears in the max and the min year selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hm, doing this for a dynamic number of selected years could be somewhat complicated, I need to rethink again.&lt;/P&gt;&lt;P&gt;Maybe someone else can step in, I probably can't spend much time on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As an alternative, you could try playing around with an extension to your data model that creates a table that fulfills all requirements for an and-mode list box. Try using a distinct load of your PersonKeys with Year field renamed to AndYear (you could rename it again in your list box).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 21:03:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354261#M131483</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-04-16T21:03:11Z</dc:date>
    </item>
    <item>
      <title>Set Analysis Intersect</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354262#M131484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have verified that it is giving a correct result by using a query on my MS SQL Db.&amp;nbsp; I do appreciate your help.&amp;nbsp; I just need to figure out how to make it more dynamic. Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 21:06:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354262#M131484</guid>
      <dc:creator />
      <dc:date>2012-04-16T21:06:42Z</dc:date>
    </item>
    <item>
      <title>Set Analysis Intersect</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354263#M131485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;following Stefan's idea you could do something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a variable, name it vSET. Variable value should be&lt;/P&gt;&lt;P&gt;='p({&amp;lt;Year={' &amp;amp; concat(distinct Year,'}&amp;gt;})*p({&amp;lt;Year={') &amp;amp; '}&amp;gt;})'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then your expression should be&lt;/P&gt;&lt;P&gt;=count({&amp;lt;PersonKey=$(vSET)&amp;gt;}&amp;nbsp; distinct PersonKey)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will cause the set analysis expression to change when the year selection changes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie. 2007, 2008, 2009, 2010 selected&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;PersonKey=p({&amp;lt;Year={2007}&amp;gt;})*p({&amp;lt;Year={2008}&amp;gt;})*p({&amp;lt;Year={2009}&amp;gt;})*p({&amp;lt;Year={2010}&amp;gt;})&amp;gt;}&amp;nbsp; distinct PersonKey)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie. 2007, 2009, 2010 selected&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;PersonKey=p({&amp;lt;Year={2007}&amp;gt;})*p({&amp;lt;Year={2009}&amp;gt;})*p({&amp;lt;Year={2010}&amp;gt;})&amp;gt;}&amp;nbsp; distinct PersonKey)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 23:19:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Intersect/m-p/354263#M131485</guid>
      <dc:creator>danielrozental</dc:creator>
      <dc:date>2012-04-16T23:19:25Z</dc:date>
    </item>
  </channel>
</rss>

