<?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: set analysis / aggr function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/set-analysis-aggr-function/m-p/1683332#M450214</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(Aggr(If(Sum({&amp;lt;Area = {34}&amp;gt;} Amount) &amp;lt; 10, Sum({&amp;lt;Type = {'AB'}&amp;gt;} Amount)), Date, S_ID, Item))&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 10 Mar 2020 14:22:02 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2020-03-10T14:22:02Z</dc:date>
    <item>
      <title>set analysis / aggr function</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-aggr-function/m-p/1683150#M450213</link>
      <description>&lt;P&gt;Hi gurus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having some set analysis / aggr function issues. I am trying to sum some specific values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Conditions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If &lt;FONT face="arial black,avant garde"&gt;Area &lt;/FONT&gt;= 34 and total amount within &lt;FONT face="arial black,avant garde"&gt;S_ID&lt;/FONT&gt; and &lt;FONT face="arial black,avant garde"&gt;Item&lt;/FONT&gt; is under 10&lt;/LI&gt;&lt;LI&gt;Then sum amount only for &lt;FONT face="arial black,avant garde"&gt;Type&lt;/FONT&gt; AB&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are multiple &lt;FONT face="arial black,avant garde"&gt;items&lt;/FONT&gt; and other &lt;FONT face="arial black,avant garde"&gt;areas&lt;/FONT&gt;. For the simplicity in the sample, I kept only one.&lt;/P&gt;&lt;P&gt;I want to show &lt;FONT face="arial black,avant garde"&gt;Date&lt;/FONT&gt;, &lt;FONT face="arial black,avant garde"&gt;Item&lt;/FONT&gt; and the calculation.&lt;/P&gt;&lt;P&gt;As you can see in the sample the total sum of all &lt;FONT face="arial,helvetica,sans-serif"&gt;Type &lt;/FONT&gt;AB’s is 45. However, the 2 lines marked with yellow should not be counted in the calc, since the total &lt;FONT face="arial,helvetica,sans-serif"&gt;amount &lt;/FONT&gt;is above 10 (total and not type specific). The result should be 29 (45-12-4 = 29).&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="QV1.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/29796iFFD65ED3C2119A2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="QV1.png" alt="QV1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test 3 gives the right result if I add the dimension of S_ID, but not without it.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="QV2.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/29797i9605542D9B058DDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="QV2.png" alt="QV2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something in Test 2 do not calculate correct, if both types is present or in case of duplicates (the orange ones). &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="QV3.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/29799iBE72702B0221C75C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="QV3.png" alt="QV3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="QV4.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/29800iF163D4026DE3D4DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="QV4.png" alt="QV4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;P&gt;Test 1: sum(if(aggr(Sum({&amp;lt;Area={34}&amp;gt;}Amount),S_ID,Item)&amp;lt;10,sum(if(Type='AB',Amount))))&lt;/P&gt;&lt;P&gt;Test 2:&amp;nbsp;sum(if(aggr(Sum({&amp;lt;Area={34}&amp;gt;}Amount),S_ID,Item)&amp;lt;10 and Type='AB',Amount))&lt;/P&gt;&lt;P&gt;Test 3: if(aggr(Sum({&amp;lt;Area={34}&amp;gt;}Amount),S_ID,Item)&amp;lt;10,sum(if(Type='AB',Amount)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas of how to accomplice this?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:05:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-aggr-function/m-p/1683150#M450213</guid>
      <dc:creator>Zwax</dc:creator>
      <dc:date>2024-11-16T01:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis / aggr function</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-aggr-function/m-p/1683332#M450214</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(Aggr(If(Sum({&amp;lt;Area = {34}&amp;gt;} Amount) &amp;lt; 10, Sum({&amp;lt;Type = {'AB'}&amp;gt;} Amount)), Date, S_ID, Item))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 10 Mar 2020 14:22:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-aggr-function/m-p/1683332#M450214</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-03-10T14:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis / aggr function</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-aggr-function/m-p/1683589#M450230</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/46628"&gt;@sunny_talwar&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(Aggr(If(Sum({&amp;lt;Area = {34}&amp;gt;} Amount) &amp;lt; 10, Sum({&amp;lt;Type = {'AB'}&amp;gt;} Amount)), Date, S_ID, Item))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nice. This solved the issue. Had to place the Area = {34} in the next sum as well to get the result I needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sum(Aggr(If(Sum({&amp;lt;Area = {34}&amp;gt;} Amount) &amp;lt; 10, Sum({&amp;lt;Area = {34}, Type = {'AB'}&amp;gt;} Amount)), Date, S_ID, Item))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Mar 2020 07:02:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-aggr-function/m-p/1683589#M450230</guid>
      <dc:creator>Zwax</dc:creator>
      <dc:date>2020-03-11T07:02:22Z</dc:date>
    </item>
  </channel>
</rss>

