<?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 How to select or exclude values based on other fields in set expression? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451668#M490422</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 want my expression to have only set expression for speed and memory (use a lot of data...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I can't figger out how to do the following in a set expression, I never get the right answer when my pivot is expanded and collapsed... Any help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AVG({$&amp;lt;Field1={1,2,3}, Field2={4}&amp;gt;} if(Field5=Field6,'',Field5))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AVG({$&amp;lt;Field1={1,2,3}, Field2={4}, Field5-=Field6&amp;gt;} Field5)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I tried a lot already...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&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;Bram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Sep 2012 07:06:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-09-28T07:06:10Z</dc:date>
    <item>
      <title>How to select or exclude values based on other fields in set expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451668#M490422</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 want my expression to have only set expression for speed and memory (use a lot of data...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I can't figger out how to do the following in a set expression, I never get the right answer when my pivot is expanded and collapsed... Any help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AVG({$&amp;lt;Field1={1,2,3}, Field2={4}&amp;gt;} if(Field5=Field6,'',Field5))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AVG({$&amp;lt;Field1={1,2,3}, Field2={4}, Field5-=Field6&amp;gt;} Field5)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I tried a lot already...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&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;Bram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2012 07:06:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451668#M490422</guid>
      <dc:creator />
      <dc:date>2012-09-28T07:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to select or exclude values based on other fields in set expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451669#M490423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bram,&lt;/P&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;P&gt;avg({$&amp;lt;Field1={1,2,3}, Field2={4},Field5={$(=only(Field6))}&amp;gt;} Field5)&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2012 07:14:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451669#M490423</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-28T07:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to select or exclude values based on other fields in set expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451670#M490424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answers, but now it still takes values when Field5=Field6... The If doesn't do this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See screenshot, actual expression in screenshot is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AVG({$&amp;lt;Field2={AA}, Field3={1}&amp;gt;} if(Field5=Field6,'',Field1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see only the if statement gets the right results...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second expression is: AVG({$&amp;lt;Field2={AA}, Field3={1}, Field5-={$(=only(Field6))}&amp;gt;} Field1)&lt;/P&gt;&lt;P&gt;Third: AVG({$&amp;lt;Field2={AA}, Field3={1}, Field5-={"Field6"}&amp;gt;} Field1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="22646" alt="QV.png" class="jive-image-thumbnail jive-image" src="https://community.qlik.com/legacyfs/online/22646_QV.png" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2012 09:07:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451670#M490424</guid>
      <dc:creator />
      <dc:date>2012-09-28T09:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to select or exclude values based on other fields in set expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451671#M490425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No one?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 05:59:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451671#M490425</guid>
      <dc:creator />
      <dc:date>2012-10-01T05:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to select or exclude values based on other fields in set expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451672#M490426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The set expression is evaluated once, ouside of the chart, and has no knowledge of the chart dimensions. In this case, this means that it does not know which value of Field6 it must compare to Field5. You original Sum(If()) expression is evaluated inside the chart and is probably the correct solution for your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to ensure that Field5 is equal to ANY possible value (based on selections) of Field6, then you could try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =AVG({$&amp;lt;Field1={1,2,3}, Field2={4}, Field5=P(Field6)&amp;gt;} Field5)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I suspect that this is not correct for your requirements. If Sum(If()) gives the correct result and the set expression above does not, then you may want to add a flag field in your load script, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field5,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field6,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Field5 = Field6, 1, 0) As Field56Flag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then use the flag in your set expression, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; =AVG({$&amp;lt;Field1={1,2,3}, Field2={4}, Field56Flag={1}&amp;gt;} Field5)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 06:19:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451672#M490426</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2012-10-01T06:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to select or exclude values based on other fields in set expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451673#M490427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help, then I guess I'll stick to the if() for now, field5 and field6 are not in the same table, so I would have to join them first to do a comparison in the load script...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I run in to too many 'object ran out of memory' I'll change my load script &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 06:28:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451673#M490427</guid>
      <dc:creator />
      <dc:date>2012-10-01T06:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to select or exclude values based on other fields in set expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451674#M490429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bram&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fact that they are in different tables expains why QV takes memory and time to calculate the expression. It has to do an in-momory join to complete the calculation and this can be resource intensive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2012 11:21:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-select-or-exclude-values-based-on-other-fields-in-set/m-p/451674#M490429</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2012-10-02T11:21:04Z</dc:date>
    </item>
  </channel>
</rss>

