<?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 condition inside Set analysis in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551021#M110428</link>
    <description>&lt;P&gt;How about below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sum({&amp;lt;Country={'France'},ProductId = {1}&amp;gt;+&amp;lt;Country-={'France'}&amp;gt;} Sales)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2026 09:14:34 GMT</pubDate>
    <dc:creator>Lech_Miszkiewicz</dc:creator>
    <dc:date>2026-06-10T09:14:34Z</dc:date>
    <item>
      <title>if condition inside Set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551019#M110426</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have a table with values like the following (simplified example):&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;PRE&gt;Country    ProductId    Sales
Spain      1            100
France     1            100
England    1            100
Portugal   1            100
Spain      2            50
France     2            50
England    2            50
Portugal   2            50&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;What I need is a Set Analysis expression where:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;For &lt;STRONG&gt;France&lt;/STRONG&gt;, only ProductId = 1 should be included&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;SPAN&gt;For all other countries, &lt;STRONG&gt;all ProductId values&lt;/STRONG&gt; should be included&lt;/SPAN&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;I know I can do something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;PRE&gt;If(Country = 'France', Sum({&amp;lt;ProductId={1}&amp;gt;} Sales), Sum(Sales))&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;…but I do &lt;STRONG&gt;not&lt;/STRONG&gt; want to use an if() outside the Set Analysis. I want the logic to be fully inside the Set modifier.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Something like this (which I know does not work):&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;PRE&gt;Sum({&amp;lt;ProductId = {if(Country='France', 1, '*')}&amp;gt;} Sales)&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;Is it possible to pass this conditional logic directly into the Set Analysis?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My goal is to avoid row‑level if() and keep everything inside the set.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2026 09:01:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551019#M110426</guid>
      <dc:creator>PabloMC</dc:creator>
      <dc:date>2026-06-10T09:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: if condition inside Set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551020#M110427</link>
      <description>&lt;P&gt;It seems like it would be much easier to just use two sums - one for France and one for everything else - and add those?&lt;/P&gt;&lt;P&gt;That said, the set analysis shouldn't be a problem using the union (+) operator and excluding France from one half:&lt;/P&gt;&lt;P&gt;{$&amp;lt;country -= {'France'}&amp;gt; &lt;STRONG&gt;+&lt;/STRONG&gt; &amp;lt;country = {'France'}, ProductId = {1}&amp;gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2026 09:13:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551020#M110427</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2026-06-10T09:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: if condition inside Set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551021#M110428</link>
      <description>&lt;P&gt;How about below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sum({&amp;lt;Country={'France'},ProductId = {1}&amp;gt;+&amp;lt;Country-={'France'}&amp;gt;} Sales)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2026 09:14:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551021#M110428</guid>
      <dc:creator>Lech_Miszkiewicz</dc:creator>
      <dc:date>2026-06-10T09:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: if condition inside Set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551034#M110430</link>
      <description>&lt;P&gt;The problem is that not always have to do that with France.&lt;/P&gt;&lt;P&gt;If user select all countries, don't have to include only ID 1, but if user select some countries, and if in this list of countries is France selected, it have to include only ID 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think i have to do an IF statement inside set analysis&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2026 11:42:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551034#M110430</guid>
      <dc:creator>PabloMC</dc:creator>
      <dc:date>2026-06-10T11:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: if condition inside Set analysis</title>
      <link>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551036#M110431</link>
      <description>&lt;P&gt;Sorry&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/436"&gt;@PabloMC&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your statement is not fully correct or it does not match the formula you would use with&amp;nbsp;statement you wanted to do:&lt;/P&gt;&lt;PRE&gt;If(Country = 'France', Sum({&amp;lt;ProductId={1}&amp;gt;} Sales), Sum(Sales))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the rule is that if France is withing possible values then for France use ProductID=1 and for all other countries use all possible products then what we suggested was "almost" correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would adjust this by adding * (intersection) sign for France so that it applies only when France is within possible values, like so:&lt;/P&gt;&lt;PRE&gt;Sum({&amp;lt;Country&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;*&lt;/STRONG&gt;&lt;/FONT&gt;={'France'},ProductId = {1}&amp;gt;+&amp;lt;Country-={'France'}&amp;gt;} Sales)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2026 11:53:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-condition-inside-Set-analysis/m-p/2551036#M110431</guid>
      <dc:creator>Lech_Miszkiewicz</dc:creator>
      <dc:date>2026-06-10T11:53:13Z</dc:date>
    </item>
  </channel>
</rss>

