<?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: IF statement to Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770236#M273464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the text box, the Flag option will work without change, but the Count(If()) will need to be in an aggr function for the row by row comparisons. Something like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum(Aggr(Count(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;{&amp;lt;FLG_ABC_Captured={'Y'}, FLG_XYZ_Captured_CMPTV={'Y'}&amp;gt;} distinct if([ABC GEO ID] = [XYZ GEO ID] and Price1 &amp;gt; Price2, [POC ID]))&lt;/SPAN&gt;, dim1, dim2))&amp;nbsp; //check brackets...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where dim1, dim2 is a comma separated list of the same dimension(s) in your table (or at least return unique values for the row by row compared fields)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the expression will take as long to evaluate as the table...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Mar 2015 09:26:38 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2015-03-10T09:26:38Z</dc:date>
    <item>
      <title>IF statement to Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770232#M273460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Trying to convert the following IF statement into set analysis. Green, bolded components of formula are the ones I am struggling with getting into working set analysis formula. Any help would be greatly appreciated. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ellen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count (distinct if(FLG_ABC_Captured='Y' and FLG_XYZ_Captured_CMPTV='Y' and &lt;STRONG style="color: #008000;"&gt;[ABC GEO ID]=[XYZ GEO ID]&lt;/STRONG&gt; and &lt;STRONG style="color: #008000;"&gt;[Price1]&amp;gt;[Price2]&lt;/STRONG&gt;, [POC ID]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 07:30:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770232#M273460</guid>
      <dc:creator>ellenblackwell</dc:creator>
      <dc:date>2015-03-10T07:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770233#M273461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ellen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why you want to use set analysis, &lt;/P&gt;&lt;P&gt;As you are doing row by row comparison if statement is correct approach to do it.&amp;nbsp; &lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #008000;"&gt;[Price1]&amp;gt;[Price2] ... &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 07:50:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770233#M273461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-10T07:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770234#M273462</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;=count ({&amp;lt;FLG_ABC_Captured={'Y'}, FLG_XYZ_Captured_CMPTV={'Y'}&amp;gt;} distinct if([ABC GEO ID] = [XYZ GEO ID] and Price1 &amp;gt; Price2, [POC ID]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can't do the other two in a set expression - this is a row by row comparison of two fields, but the set expression is calculated once for the chart/table, not once per row. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way to avoid the Count(If()) here is to create a flag in the load script - something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If([ABC GEO ID] = [XYZ GEO ID] and Price1 &amp;gt; Price2, 1, 0) As Flag1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now add a Flag1 = {1} clause to the set expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 07:53:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770234#M273462</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-03-10T07:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770235#M273463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the accurate, more elegant approach. I have many formulas that look like the one in my original request. The table containing the formulas loads excruciatingly slowly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also want to create a total in a Text Box object. Without the additional flag you mentioned, I will have to use the same formula you updated, correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 09:07:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770235#M273463</guid>
      <dc:creator>ellenblackwell</dc:creator>
      <dc:date>2015-03-10T09:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement to Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770236#M273464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the text box, the Flag option will work without change, but the Count(If()) will need to be in an aggr function for the row by row comparisons. Something like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum(Aggr(Count(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;{&amp;lt;FLG_ABC_Captured={'Y'}, FLG_XYZ_Captured_CMPTV={'Y'}&amp;gt;} distinct if([ABC GEO ID] = [XYZ GEO ID] and Price1 &amp;gt; Price2, [POC ID]))&lt;/SPAN&gt;, dim1, dim2))&amp;nbsp; //check brackets...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where dim1, dim2 is a comma separated list of the same dimension(s) in your table (or at least return unique values for the row by row compared fields)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the expression will take as long to evaluate as the table...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 09:26:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-to-Set-Analysis/m-p/770236#M273464</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-03-10T09:26:38Z</dc:date>
    </item>
  </channel>
</rss>

