<?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 Strange SUM behavior in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702218#M1075801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a strange issue where 'sum' function is acting as if there was a distinct command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I've got my individual line items:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="issue2.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/62622_issue2.jpg" style="width: 620px; height: 74px;" /&gt;&lt;/P&gt;&lt;P&gt;And here I've got the items grouped under it's product code.&lt;BR /&gt;&lt;IMG alt="issue1.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/62639_issue1.jpg" /&gt;&lt;/P&gt;&lt;P&gt;You'll notice though that while sum ForecastedDetailActualAmt is correct, sum Disti Cost is wrong and seems to have picked the two distinct/different numbers to add together (31525 + 38768).&amp;nbsp; As you can see I don't have distinct in my expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea what's going on? This is the first I've seen this happen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Carlo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Jul 2014 06:22:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-07-18T06:22:14Z</dc:date>
    <item>
      <title>Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702218#M1075801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a strange issue where 'sum' function is acting as if there was a distinct command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I've got my individual line items:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="issue2.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/62622_issue2.jpg" style="width: 620px; height: 74px;" /&gt;&lt;/P&gt;&lt;P&gt;And here I've got the items grouped under it's product code.&lt;BR /&gt;&lt;IMG alt="issue1.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/62639_issue1.jpg" /&gt;&lt;/P&gt;&lt;P&gt;You'll notice though that while sum ForecastedDetailActualAmt is correct, sum Disti Cost is wrong and seems to have picked the two distinct/different numbers to add together (31525 + 38768).&amp;nbsp; As you can see I don't have distinct in my expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea what's going on? This is the first I've seen this happen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Carlo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 06:22:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702218#M1075801</guid>
      <dc:creator />
      <dc:date>2014-07-18T06:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702219#M1075802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think that this is what you have in your data model and that QlikView shows the correct numbers. But to be sure, I need to look at the data model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See more on &lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2014/06/23/subtotals"&gt;Totals in Charts&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 06:29:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702219#M1075802</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-07-18T06:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702220#M1075803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;go to chart properties-&amp;gt; select your expression(Sum([Disti Cost])-&amp;gt; Total Mode-&amp;gt; Sum in drop down &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 06:34:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702220#M1075803</guid>
      <dc:creator>SunilChauhan</dc:creator>
      <dc:date>2014-07-18T06:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702221#M1075804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you attach some sample file, so that it would be easier to check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 06:53:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702221#M1075804</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-07-18T06:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702222#M1075805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Henric,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate the help - thanks.&amp;nbsp; Do you want the qvw file?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Carlo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 06:56:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702222#M1075805</guid>
      <dc:creator />
      <dc:date>2014-07-18T06:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702223#M1075806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would help if you post it. I am not sure that I will have time to look at it, but there are plenty of other smart people on this community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect that you only have the two records in the data, and that one of them appears on two lines in your chart due to one of the dimensions. It is pretty much along the lines of the "&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #f5faf0;"&gt;many-to-many relationship&lt;/SPAN&gt;" described in the blog post. Then the sum is correct the way it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 07:16:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702223#M1075806</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-07-18T07:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702224#M1075807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you please send the QVW file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 07:21:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702224#M1075807</guid>
      <dc:creator />
      <dc:date>2014-07-18T07:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702225#M1075808</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;&lt;/P&gt;&lt;P&gt;Here's the qvw file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Carlo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 07:31:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702225#M1075808</guid>
      <dc:creator />
      <dc:date>2014-07-18T07:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702226#M1075809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you missed the attachment&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 07:39:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702226#M1075809</guid>
      <dc:creator />
      <dc:date>2014-07-18T07:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702227#M1075810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to re-think your data model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Image1.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/62635_Image1.png" style="width: 620px; height: 462px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 07:44:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702227#M1075810</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2014-07-18T07:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702228#M1075811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think the correct sum is the second, the first one seems duplicated...The table "pricelist" has less granularity than "com_v_apac...".&lt;/P&gt;&lt;P&gt;Apart from that the behaviour is strange maybe because of all that syntetic keys you have. The syntetic keys affects the behaviour of the data and the performance of the model.&lt;/P&gt;&lt;P&gt;You should aviod them joining tables or creating keys composed by several concatenated fields.&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 08:20:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702228#M1075811</guid>
      <dc:creator />
      <dc:date>2014-07-18T08:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702229#M1075812</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;&lt;/P&gt;&lt;P&gt;Thanks for all the help - really appreciate it! I've done further testing based on your feedback.&amp;nbsp; I've greatly simplified the data model to have only two sources as follows:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="issue3.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/62743_issue3.jpg" /&gt;&lt;/P&gt;&lt;P&gt;However, I'm still having problems summing up my disti cost.&amp;nbsp; It appears that if the disti cost is not unique - it doesn't get counted.&amp;nbsp; For instance, if i pick a product (SKU) under Australia - then the sum function only comes up with a single row value instead of summing up all of the rows that come under those parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having read Henric's suggestions - is the problem caused by the fact that the same product (SKU) appear under multiple countries/regions?&amp;nbsp; How do i overcome this? Will using aggr function assist?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Carlo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 01:38:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702229#M1075812</guid>
      <dc:creator />
      <dc:date>2014-07-21T01:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702230#M1075813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arrive a composite key for the two columns in both the tables and rename/drop the region and SKU columns in fact table.&amp;nbsp; Please check the script below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FactTable:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Region &amp;amp; '_' &amp;amp; SKU AS RegionSKUKey,&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp; FactTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PriceList:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;Region &amp;amp; '_' &amp;amp; SKU AS RegionSKUKey,&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;FROM&amp;nbsp; FactTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DROP Fields Region, SKU FROM FactTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 02:07:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702230#M1075813</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2014-07-21T02:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702231#M1075814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look this:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 02:50:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702231#M1075814</guid>
      <dc:creator>felipe_dutra</dc:creator>
      <dc:date>2014-07-21T02:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702232#M1075815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use this &lt;/P&gt;&lt;P&gt;sum(aggr(sum([Dist Cost]),SKU,Country,Opty))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 04:25:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702232#M1075815</guid>
      <dc:creator>preminqlik</dc:creator>
      <dc:date>2014-07-21T04:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Strange SUM behavior</title>
      <link>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702233#M1075816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simplifying your model will improve performance, but will not affect your issue. You are summing disti cost by region - this does not involve the other table(s) at all, only the pricelist table. So it is summing disti cost by region without considering the quantities in the com_v_apac.... table. If disti cost is a unit price, then it is meaningless summing this any way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to consider the quantity in com_v_apac... you will need to bring this into the expression in some way - for example a unit cost from pricelist and a quantity from com_v_apac...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 05:44:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Strange-SUM-behavior/m-p/702233#M1075816</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2014-07-21T05:44:47Z</dc:date>
    </item>
  </channel>
</rss>

