<?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 - Qualifying global set with current selections in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223548#M76047</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;Maybe my solution works for you.&lt;/P&gt;&lt;P&gt;I think there would be a possible optimization in the variable calculation, but I'm not sure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt; =if(getexcludedcount(Dept) &amp;gt; 0,concat('"' &amp;amp; Dept &amp;amp; '"',','))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Sep 2010 10:27:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-09-30T10:27:04Z</dc:date>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223547#M76046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings set analysis gurus. Consider the following table:&lt;/P&gt;&lt;P&gt;Dept, Account, Period, Value&lt;BR /&gt;D1, A1, 1, 100&lt;BR /&gt;D2, A2, 1, 200&lt;BR /&gt;D2, A2, 2, 300&lt;BR /&gt;D2, A3, 2, 350&lt;BR /&gt;D3, A2, 2, 400&lt;BR /&gt;D3, A3, 2, 500&lt;BR /&gt;D3, A4, 2, 600&lt;/P&gt;&lt;P&gt;I select Period 1 and Dept D2 as my current selections. I want to display the Values from the selected period (1) and the next period (2). I want the chart to only show accounts that are linked to the selections -- A2 &amp;amp; A3 in this case. Using the following for the Period 2 expression:&lt;/P&gt;&lt;P&gt;=sum( {1&amp;lt;Period = {$(#=Only(Period)+1)}&amp;gt;} Value )&lt;/P&gt;&lt;P&gt;I get Account A4, which is not part of the selection.&lt;/P&gt;&lt;P&gt;&lt;!--StartFragment--&gt;&lt;/P&gt;&lt;TABLE bgcolor="white" border="1" bordercolor="white" cellpadding="0" cellspacing="0" style="font-size: 9pt;"&gt;&lt;TBODY&gt;&lt;TR align="left" bgcolor="#F5F5F5"&gt;&lt;TH&gt;&lt;B&gt;Account&lt;/B&gt; &lt;B&gt;&lt;/B&gt;&lt;/TH&gt;&lt;TH&gt;&lt;B&gt;Period 1&lt;/B&gt; &lt;B&gt;&lt;/B&gt;&lt;/TH&gt;&lt;TH&gt;&lt;B&gt;Period 2&lt;/B&gt; &lt;B&gt;&lt;/B&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR align="right" bgcolor="white"&gt;&lt;TD align="left" bgcolor="white"&gt;A2&lt;/TD&gt;&lt;TD bgcolor="white"&gt;200&lt;/TD&gt;&lt;TD bgcolor="white"&gt;700&lt;/TD&gt;&lt;/TR&gt;&lt;TR align="right" bgcolor="white"&gt;&lt;TD align="left" bgcolor="white"&gt;A3&lt;/TD&gt;&lt;TD bgcolor="white"&gt;0&lt;/TD&gt;&lt;TD bgcolor="white"&gt;850&lt;/TD&gt;&lt;/TR&gt;&lt;TR align="right" bgcolor="white"&gt;&lt;TD align="left" bgcolor="white"&gt;A4&lt;/TD&gt;&lt;TD bgcolor="white"&gt;0&lt;/TD&gt;&lt;TD bgcolor="white"&gt;600&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;!--StartFragment--&gt;&lt;!--StartFragment--&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;I can modify the expression to include the Dept, but this only works when I select a single Dept.&lt;/P&gt;&lt;P&gt;=sum( {1&amp;lt;Period = {$(#=Only(Period)+1)}, Dept = {$(=Only(Dept))}&amp;gt;} Value )&lt;/P&gt;&lt;P&gt;&lt;!--StartFragment--&gt;&lt;/P&gt;&lt;TABLE bgcolor="white" border="1" bordercolor="white" cellpadding="0" cellspacing="0" style="font-size: 9pt;"&gt;&lt;TBODY&gt;&lt;TR align="left" bgcolor="#F5F5F5"&gt;&lt;TH&gt;&lt;B&gt;Account&lt;/B&gt; &lt;B&gt;&lt;/B&gt;&lt;/TH&gt;&lt;TH&gt;&lt;B&gt;Period 1&lt;/B&gt; &lt;B&gt;&lt;/B&gt;&lt;/TH&gt;&lt;TH&gt;&lt;B&gt;Period 2&lt;/B&gt; &lt;B&gt;&lt;/B&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR align="right" bgcolor="white"&gt;&lt;TD align="left" bgcolor="white"&gt;A2&lt;/TD&gt;&lt;TD bgcolor="white"&gt;200&lt;/TD&gt;&lt;TD bgcolor="white"&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR align="right" bgcolor="white"&gt;&lt;TD align="left" bgcolor="white"&gt;A3&lt;/TD&gt;&lt;TD bgcolor="white"&gt;0&lt;/TD&gt;&lt;TD bgcolor="white"&gt;350&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;What expression would I use for Period 2 if I to filter with multiple selected Dept, for example, both D1 &amp;amp; D2 selected. In that case I would expect to see accounts A1 &amp;amp; A2 with correct values.&lt;/P&gt;&lt;P&gt;An example qvvw is attached.&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 08:03:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223547#M76046</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-09-30T08:03:45Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223548#M76047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;Maybe my solution works for you.&lt;/P&gt;&lt;P&gt;I think there would be a possible optimization in the variable calculation, but I'm not sure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt; =if(getexcludedcount(Dept) &amp;gt; 0,concat('"' &amp;amp; Dept &amp;amp; '"',','))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 10:27:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223548#M76047</guid>
      <dc:creator />
      <dc:date>2010-09-30T10:27:04Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223549#M76048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;You got A4 from your first expression because of the &lt;B&gt;{1&amp;lt;&lt;/B&gt; set selector which overrides all selections (including your Department selection).&lt;/P&gt;&lt;P&gt;If I've understood you correctly, Just remove the 1, so the expression reads:&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;Period = {$(#=Only(Period)+1)}&amp;gt;} Value)&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 10:43:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223549#M76048</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2010-09-30T10:43:08Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223550#M76049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Miguel! Your solution works great.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 16:32:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223550#M76049</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-09-30T16:32:09Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223551#M76050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;Jonathan Dienst wrote:If I've understood you correctly, Just remove the 1, so the expression reads:&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I need the 1 selector to get data from the other period -- which is not selected.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Sep 2010 16:33:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223551#M76050</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-09-30T16:33:42Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223552#M76051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;Jonathans suggestion will work. You wont need the {1} for the second period as period is a dimension in the chart. I have just tried it and it looks correct.&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Footsie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 09:03:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223552#M76051</guid>
      <dc:creator />
      <dc:date>2010-10-01T09:03:51Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223553#M76052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not seeing how it would work without the "1" selector. Can you post a working qvw based on my original example?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 01:29:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223553#M76052</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-10-05T01:29:57Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223554#M76053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;Rob Wunderlich wrote:I'm not seeing how it would work without the "1" selector. Can you post a working qvw based on my original example?&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I'm a bit confused about the final result that you want, but since you verified Miguel's answer, I guess you want the table that he shows when no departments are selected? If so, this returns the same answer using only set analysis and no variables:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;Dept=P(),Period={$(=Only(Period)+1)}&amp;gt;} Value)&lt;/P&gt;&lt;P&gt;Dept=P() says to "select" only the possible departments based on the other selections. So you'll only get period 1 departments, D1 and D2. Then we override the Period selection, adding 1 to it. The "1" set shouldn't be used as we don't want to override ALL selections, only the period selection. See attached. Hopefully I've understood what you're looking for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 02:02:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223554#M76053</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-10-05T02:02:15Z</dc:date>
    </item>
    <item>
      <title>Set Analysis - Qualifying global set with current selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223555#M76054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks John. That's a cleaner solution. I like it and it gives me the result I'm after.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Oct 2010 01:40:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Qualifying-global-set-with-current-selections/m-p/223555#M76054</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-10-06T01:40:05Z</dc:date>
    </item>
  </channel>
</rss>

