<?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: Strange behavior with sum() and aggr() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765107#M1032636</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured that in this specific case&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum(A)*B = sum(A*B), since B is identical for all siteID's.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;It's basically just like &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;1*2+2*2+3*2 = (1+2+3)*2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Does QlikView's sum() work in a different way?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 08 Feb 2015 15:06:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-02-08T15:06:56Z</dc:date>
    <item>
      <title>Strange behavior with sum() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765105#M1032634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm working on this straight table:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="aggr_sum.PNG" class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/77372_aggr_sum.PNG" style="height: 122px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;I've 2 fields, A and B. B has the same value for all rows, but A differs and sometimes is null. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I wish to calculate sum of A*B for every siteId and weekNum.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I tried doing this with 3 different expressions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;sum(A)*B : gave the correct results.&lt;/LI&gt;&lt;LI&gt;sum(A*B) : gave a result &lt;STRONG&gt;twice&lt;/STRONG&gt; as large as that of sum(A)*B&lt;/LI&gt;&lt;LI&gt;sum(aggr(sum(A*B,siteid))) : gives the correct numbers, but on the wrong lines...&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea why only sum(A)*B gives the correct results?&lt;/P&gt;&lt;P&gt;Thank&amp;nbsp; you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 13:59:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765105#M1032634</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-02-08T13:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behavior with sum() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765106#M1032635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your expression should be: sum(A) * only(B). Your second expression aggregated B and led therefore to the wrong results. The third expression had a incorrect syntax and should be rather like: sum(aggr(sum(A)*only(B),siteid)).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But why will you use them? Also why didn't you hide NULL in field A?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To aggeregations and especially with the aggr-function see here:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3235"&gt;It’s all Aggregations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2967"&gt;AGGR...&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/2980"&gt;When should the Aggr() function NOT be used?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 14:58:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765106#M1032635</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-02-08T14:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behavior with sum() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765107#M1032636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured that in this specific case&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum(A)*B = sum(A*B), since B is identical for all siteID's.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;It's basically just like &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;1*2+2*2+3*2 = (1+2+3)*2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Does QlikView's sum() work in a different way?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 15:06:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765107#M1032636</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-02-08T15:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behavior with sum() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765108#M1032637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This isn't the point:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;F1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(F1*F2)&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - &lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 * (2 + 2) = 8 // and not on row-level 2 * 2 = 4&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This results because F1 is for both rows identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 15:30:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765108#M1032637</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-02-08T15:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Strange behavior with sum() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765109#M1032638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey..am trying to replicate and understand the abnormal behaviour. But I am unabel to replicate.&lt;/P&gt;&lt;P&gt;Below is waht I used. Am I missing something.&lt;/P&gt;&lt;P&gt;Set NullInterpret = 'A'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;A, B, C&lt;/P&gt;&lt;P&gt;1,2,3&lt;/P&gt;&lt;P&gt;2,A,3&lt;/P&gt;&lt;P&gt;3,3,3&lt;/P&gt;&lt;P&gt;4,A,3&lt;/P&gt;&lt;P&gt;5,4,3&lt;/P&gt;&lt;P&gt;]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;and my output for sum(B*C) is coming correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting curious to replicate whats happenign above,&lt;/P&gt;&lt;P&gt;Please help and explain&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Feb 2015 10:11:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-behavior-with-sum-and-aggr/m-p/765109#M1032638</guid>
      <dc:creator>sonikajain</dc:creator>
      <dc:date>2015-02-11T10:11:13Z</dc:date>
    </item>
  </channel>
</rss>

