<?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: Aggr with if in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667361#M50331</link>
    <description>&lt;P&gt;It's possible in the form you propose.&amp;nbsp; You need to calculate the Aggr dim as a Dollar Sign Expansion (DSE) like this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;SUM(AGGR(Sales*Amount, $(=if (GetSelectedCount(Class)&amp;gt;0, 'Class', 'Derivate'))))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note the field returned from the if is a 'string'. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Because DSE is calculated once per chart, this works if you have a single condition for the entire chart.&amp;nbsp; If you needed to have your condition tested row by chart row you would need to write it like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;if(somecondition, SUM(AGGR(Sales*Amount,&amp;nbsp; &amp;nbsp;Class)),&amp;nbsp; SUM(AGGR(Sales*Amount,&amp;nbsp; &amp;nbsp;Derivate)))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Your combination of Sum(Aggr()) didn't look logical to me, but I think that's irrelevant to the syntax question.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank" rel="noopener"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank" rel="noopener"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank" rel="noopener"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2020 14:11:24 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2020-01-23T14:11:24Z</dc:date>
    <item>
      <title>Aggr with if</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667322#M50321</link>
      <description>&lt;P&gt;Hi team,&lt;/P&gt;&lt;P&gt;is it possible to have an if-statement for the aggregation level?&lt;/P&gt;&lt;P&gt;I want to have Sales*Amount, aggregated by&amp;nbsp; either Derivate oder Class (depending of the user selection).&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;SUM(AGGR(Sales*Amount,&amp;nbsp; &amp;nbsp;if (GetSelectedCount(Class)&amp;gt;0, Class, Derivate )))&lt;/P&gt;&lt;P&gt;Thanks Swen &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:31:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667322#M50321</guid>
      <dc:creator>SwenWa</dc:creator>
      <dc:date>2024-11-16T03:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with if</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667331#M50326</link>
      <description>&lt;P&gt;Perhaps this way?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(GetSelectedCount(Class)&amp;gt;0, Sum({&amp;lt;Class=P(Class)&amp;gt;} (Sales*Amount),&amp;nbsp;Sum({&amp;lt;Derivate=P(Derivate)&amp;gt;} (Sales*Amount))&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 13:24:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667331#M50326</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2020-01-20T13:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with if</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667334#M50327</link>
      <description>&lt;P&gt;Thanks! Yes this works, but it is not exactly what I was looking for. Is there bo possibility to have it in the aggr expression?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 13:39:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667334#M50327</guid>
      <dc:creator>SwenWa</dc:creator>
      <dc:date>2020-01-20T13:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr with if</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667361#M50331</link>
      <description>&lt;P&gt;It's possible in the form you propose.&amp;nbsp; You need to calculate the Aggr dim as a Dollar Sign Expansion (DSE) like this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;SUM(AGGR(Sales*Amount, $(=if (GetSelectedCount(Class)&amp;gt;0, 'Class', 'Derivate'))))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note the field returned from the if is a 'string'. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Because DSE is calculated once per chart, this works if you have a single condition for the entire chart.&amp;nbsp; If you needed to have your condition tested row by chart row you would need to write it like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;if(somecondition, SUM(AGGR(Sales*Amount,&amp;nbsp; &amp;nbsp;Class)),&amp;nbsp; SUM(AGGR(Sales*Amount,&amp;nbsp; &amp;nbsp;Derivate)))&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Your combination of Sum(Aggr()) didn't look logical to me, but I think that's irrelevant to the syntax question.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank" rel="noopener"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank" rel="noopener"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank" rel="noopener"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 14:11:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-with-if/m-p/1667361#M50331</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2020-01-23T14:11:24Z</dc:date>
    </item>
  </channel>
</rss>

