<?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: Set Analysis Field1 - Field2 in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Field1-Field2/m-p/242860#M496906</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also assume that Field1 and Field2 can have multiple values, furthermore, I assume that these values are not unique. So you could have combinations for Field1 and Field2 like&lt;/P&gt;&lt;P&gt;Field1 Field2&lt;/P&gt;&lt;P&gt;30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only the first record will match your requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also think that you can't use a set expression to select on Field1 or Field2, at least I can't think of a correct syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you have a field with unique records, like a record ID (e.g. using recno() in the load),&amp;nbsp; I think something like this should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;ID={"=(Field1-Field2)&amp;lt;29"}&amp;gt;} Value)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see attached sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Dec 2011 21:31:37 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2011-12-30T21:31:37Z</dc:date>
    <item>
      <title>Set Analysis Field1 - Field2</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Field1-Field2/m-p/242858#M496904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to include in my Set Analysis a statement like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field1 - Field2 &amp;lt; 29&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field1 - Field2 = {"&amp;lt;29"}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And also&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(=Field1 - Field2) = {"&amp;lt;29"}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And other variations of these but none of them worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how can I do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, precalculate this in the load script is not an option. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Dec 2011 17:21:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Field1-Field2/m-p/242858#M496904</guid>
      <dc:creator />
      <dc:date>2011-12-30T17:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Field1 - Field2</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Field1-Field2/m-p/242859#M496905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't have anything other than a single field on the left side of the =.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think you can do what you want with set analysis unless either Field1 or Field2 has just a single possible value.&amp;nbsp; A set is evaluated once for the entire chart, so if both fields have multiple values, you can't use set analysis for the chart.&amp;nbsp; If Field2 has a single value, I believe you could write it like this, and something similar if Field1 has a single value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;{&amp;lt;Field1={"&amp;lt;$(=Field2+29)"}&amp;gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If Field1 and Field2 can have multiple values, you'll probably need to do it with an if(), such as sum(if(Field1-Field2&amp;lt;29,Value)).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Dec 2011 17:37:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Field1-Field2/m-p/242859#M496905</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2011-12-30T17:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Field1 - Field2</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Field1-Field2/m-p/242860#M496906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also assume that Field1 and Field2 can have multiple values, furthermore, I assume that these values are not unique. So you could have combinations for Field1 and Field2 like&lt;/P&gt;&lt;P&gt;Field1 Field2&lt;/P&gt;&lt;P&gt;30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only the first record will match your requirement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also think that you can't use a set expression to select on Field1 or Field2, at least I can't think of a correct syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you have a field with unique records, like a record ID (e.g. using recno() in the load),&amp;nbsp; I think something like this should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;ID={"=(Field1-Field2)&amp;lt;29"}&amp;gt;} Value)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see attached sample.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Dec 2011 21:31:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Field1-Field2/m-p/242860#M496906</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-12-30T21:31:37Z</dc:date>
    </item>
  </channel>
</rss>

