<?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 Simulate an If statement using Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Simulate-an-If-statement-using-Set-Analysis/m-p/161745#M35524</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to calculate something based on a criteria like this:&lt;/P&gt;&lt;P&gt;If Column A = 1 Then Sum the Amount where ProductGroup = A And Month&amp;lt;= Month selected&lt;/P&gt;&lt;P&gt;If ColumnA = 2 Then Sum the amount where ProductGroup = B And CostCenter = 1111 And Month = Month selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sum part of the set analysis I know how to do, but my question is about the If ColumnA. How can I do that without using an IF?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Oct 2010 18:54:26 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-10-27T18:54:26Z</dc:date>
    <item>
      <title>Simulate an If statement using Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Simulate-an-If-statement-using-Set-Analysis/m-p/161745#M35524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to calculate something based on a criteria like this:&lt;/P&gt;&lt;P&gt;If Column A = 1 Then Sum the Amount where ProductGroup = A And Month&amp;lt;= Month selected&lt;/P&gt;&lt;P&gt;If ColumnA = 2 Then Sum the amount where ProductGroup = B And CostCenter = 1111 And Month = Month selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sum part of the set analysis I know how to do, but my question is about the If ColumnA. How can I do that without using an IF?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 18:54:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Simulate-an-If-statement-using-Set-Analysis/m-p/161745#M35524</guid>
      <dc:creator />
      <dc:date>2010-10-27T18:54:26Z</dc:date>
    </item>
    <item>
      <title>Simulate an If statement using Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Simulate-an-If-statement-using-Set-Analysis/m-p/161746#M35525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do the ColumnA checks with IFs (or a pick(ColumnA)). The IFs will only be evaluated once, not once per row, so there is no advantage to putting them inside of the set analysis. Putting them in the set analysis will probably just slow things down. But just for demonstration purposes, I believe this is how you'd do it:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;ColumnA*={'1'},ProductGroup={'A'},Month={"&amp;lt;=$(=Month)"}&amp;gt;&lt;BR /&gt; +&amp;lt;ColumnA*={'2'},ProductGroup={'B'},CostCenter={'1111'}&amp;gt;} Amount)&lt;/P&gt;&lt;P&gt;Two things are going on here. First, there's the *= syntax, which says to intersect your selection with the value. In other words, for ColumnA*={'1'}, the set will just be '1' if '1' is selected, otherwise it will be an empty set. Second, we union two sets together with the + operator. This is functioning as an OR, basically. The net effect of both should be the same as your IFs. Better to use IFs, though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Oct 2010 20:04:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Simulate-an-If-statement-using-Set-Analysis/m-p/161746#M35525</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-10-27T20:04:31Z</dc:date>
    </item>
  </channel>
</rss>

