<?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 vs if() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609678#M225044</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not 100% sure what you want to achieve:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to calculate the proportion of Age Bucket count compared to the total patient count, you can use something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;Age_Bucket = {1}&amp;gt;} Patient_Count) / sum({1} Patient_Count)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to regard your selection in Age_Bucket, so you get zero when you select a bucket different from 1, then you can use set intersection operator *:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;Age_Bucket *= {1}&amp;gt;} Patient_Count) / sum( Patient_Count)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 May 2014 20:05:37 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2014-05-07T20:05:37Z</dc:date>
    <item>
      <title>Set Analysis vs if()</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609677#M225043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been using set analysis to limit my select statements, as seen below:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Age_Bucket={1}&amp;gt;} Patient_Count)/sum(Patient_Count) =&amp;gt; % of Population that is in Age Bucket 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works great until you make a selection for Age_Bucket, which then does not affect the numerator but changes the denominator. Which is some cases gives you numbers like 180% or 200%+&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I change my expressions to sum(if(Age_Bucket=1,1,0)) it works as I would expect. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm wondering if this is a viable option when dealing with a large data set. I'm worried that using the if statements will be detrimental to my performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a better way to accomplish what I'm trying to do and still accommodate for a selection in the field used within the set analysis?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 19:54:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609677#M225043</guid>
      <dc:creator />
      <dc:date>2014-05-07T19:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis vs if()</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609678#M225044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not 100% sure what you want to achieve:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to calculate the proportion of Age Bucket count compared to the total patient count, you can use something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;Age_Bucket = {1}&amp;gt;} Patient_Count) / sum({1} Patient_Count)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to regard your selection in Age_Bucket, so you get zero when you select a bucket different from 1, then you can use set intersection operator *:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;Age_Bucket *= {1}&amp;gt;} Patient_Count) / sum( Patient_Count)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 20:05:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609678#M225044</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-05-07T20:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis vs if()</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609679#M225045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A third alternative could be to use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;sum({$&amp;lt;Age_Bucket={1}&amp;gt;} Patient_Count)/sum(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;{$&amp;lt;Age_Bucket=&amp;gt;} &lt;/SPAN&gt;Patient_Count)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;which would make both the numerator and denominator independent of selections in Age_Bucket.&lt;/SPAN&gt;&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, 07 May 2014 20:44:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609679#M225045</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-05-07T20:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis vs if()</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609680#M225046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Henric solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Henric, why do you use $, is it just a habit or will it give some message to Qlikview &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; to run faster?&lt;/P&gt;&lt;P&gt;I am assuming the default is $&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;sum({&amp;lt;Age_Bucket={1}&amp;gt;} Patient_Count)/sum(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;{&amp;lt;Age_Bucket=&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Patient_Count)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 21:25:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609680#M225046</guid>
      <dc:creator />
      <dc:date>2014-05-07T21:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis vs if()</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609681#M225047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is just a habit. It will not make any changes to how QlikView evaluates the formula.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am a firm believer in writing code that is clear, distinct and easily legible. I dislike shortcuts and sloppy code. When you write code, you must always do that little extra that makes your code understandable for another developer. Omitting the $ sign is a shortcut that in some cases makes the expression less clear, so I think you should have it there. Maybe I am picky...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2014 08:43:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609681#M225047</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-05-08T08:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis vs if()</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609682#M225048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You just need to be aware that there is a difference between&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;sum({&amp;lt;Age_Bucket={1}&amp;gt;} Patient_Count)/sum(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;{&amp;lt;Age_Bucket=&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Patient_Count)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;and&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;sum({$&amp;lt;Age_Bucket={1}&amp;gt;} Patient_Count)/sum(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;{$&amp;lt;Age_Bucket=&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Patient_Count)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;when you use these expressions in a chart that is set to an alternate state.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2014 10:26:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609682#M225048</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-05-08T10:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis vs if()</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609683#M225049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! makes sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2014 12:53:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609683#M225049</guid>
      <dc:creator />
      <dc:date>2014-05-08T12:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis vs if()</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609684#M225050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Swuehl,&amp;nbsp; did you mean if I don't use the $, it uses the state of the object?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 May 2014 12:59:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-vs-if/m-p/609684#M225050</guid>
      <dc:creator />
      <dc:date>2014-05-08T12:59:35Z</dc:date>
    </item>
  </channel>
</rss>

