<?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 Combination of Set analysis and IF statement in Script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Combination-of-Set-analysis-and-IF-statement-in-Script/m-p/75008#M4979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I wanted to write the below expression in the Load Editor.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;if(Technology='Mobile',Sum({&amp;lt;Device={'ABC'}&amp;gt;}Sales),Sum({&amp;lt;Device={'XYZ'}&amp;gt;}Sales))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 16 Nov 2024 08:26:31 GMT</pubDate>
    <dc:creator>satish25</dc:creator>
    <dc:date>2024-11-16T08:26:31Z</dc:date>
    <item>
      <title>Combination of Set analysis and IF statement in Script</title>
      <link>https://community.qlik.com/t5/App-Development/Combination-of-Set-analysis-and-IF-statement-in-Script/m-p/75008#M4979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I wanted to write the below expression in the Load Editor.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;if(Technology='Mobile',Sum({&amp;lt;Device={'ABC'}&amp;gt;}Sales),Sum({&amp;lt;Device={'XYZ'}&amp;gt;}Sales))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Nov 2024 08:26:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combination-of-Set-analysis-and-IF-statement-in-Script/m-p/75008#M4979</guid>
      <dc:creator>satish25</dc:creator>
      <dc:date>2024-11-16T08:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Combination of Set analysis and IF statement in Script</title>
      <link>https://community.qlik.com/t5/App-Development/Combination-of-Set-analysis-and-IF-statement-in-Script/m-p/75009#M4980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set expressions are not supported in the load script. You can only use it in the applications "User Interface" expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can achieve what you want by using aggregations anyway without the set expressions or by splitting the values into two different fields. The choice of approach is dependent on what your data model looks like and what you have done already in your load script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) With aggregation Sum and a mandatory GROUP BY:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FieldN, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If( Technology ='Mobile&lt;SPAN style="font-size: 13.3333px;"&gt;'&lt;/SPAN&gt; AND Device='ABC', Sum(Sales)) AS ABC_Sales,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If( Technology &amp;lt;&amp;gt;'Mobile&lt;SPAN style="font-size: 13.3333px;"&gt;'&lt;/SPAN&gt; AND Device='XYZ', Sum(Sales)) AS XYZ_Sales&lt;/P&gt;&lt;P&gt;FROM .......&lt;/P&gt;&lt;P&gt;GROUP BY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Field1, ....., FieldN;&amp;nbsp;&amp;nbsp; // All the non-aggregation fields that is also present above in the beginning of the LOAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Probably you dont even need to do aggregation in the load script. The aggregation (in this case Sum) is appropriate and necessary in expressions in the UI since set expressions cant be used except within an aggregation function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Simple approach when summing is not necessary:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; .....&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If( Technology ='Mobile&lt;SPAN style="font-size: 13.3333px;"&gt;'&lt;/SPAN&gt; AND Device='ABC', Sales) AS ABC_Sales,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If( Technology &amp;lt;&amp;gt;'Mobile&lt;SPAN style="font-size: 13.3333px;"&gt;'&lt;/SPAN&gt; AND Device='XYZ', Sales) AS XYZ_Sales&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;FROM&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp; ....&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2018 05:35:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Combination-of-Set-analysis-and-IF-statement-in-Script/m-p/75009#M4980</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2018-04-09T05:35:21Z</dc:date>
    </item>
  </channel>
</rss>

