<?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: Partial Sums Incorrect on the Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731226#M1070681</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jermiah , that puts in the correct total but in some cases 'Lbs Needed after on Hand' is not being calculated properly. Continuing with the example , I added on more data set to explain further, like for PQR 'Lbs Needed after on Hand' shows 0 instead of showing 52 &lt;/P&gt;&lt;P&gt;&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;&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;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="976"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" width="73"&gt;ItemKey&lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="324"&gt;Lbs Needed &lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="189"&gt;On Hand Lbs&lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="390"&gt;Lbs Needed&lt;BR /&gt;&amp;nbsp; after On Hand&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;Dimension&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="96" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;=Sum({&amp;lt;Dt=&lt;BR /&gt;&amp;nbsp; {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;/TD&gt;&lt;TD class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;=SUM(distinct&lt;BR /&gt;&amp;nbsp; Qty*ConvtoLbs)&lt;/TD&gt;&lt;TD class="xl68" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="390"&gt;=&lt;BR /&gt;&amp;nbsp; sum(aggr (if (&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) &amp;lt; 0 , 0 ,&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) ),ItemKey))&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;23&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;PQR&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;52&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl69" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;XYZ&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;72&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;150&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;STU&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;42&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;42&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;Totals&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;189&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;152&lt;/TD&gt;&lt;TD class="xl70" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;63&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Aug 2014 19:38:16 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-08-22T19:38:16Z</dc:date>
    <item>
      <title>Partial Sums Incorrect on the Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731224#M1070679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 976px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="19" width="73"&gt;&lt;STRONG&gt;Item Key&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="324"&gt;&lt;STRONG&gt;Lbs Needed &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="189"&gt;&lt;STRONG&gt;On Hand Lbs&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl63" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="390"&gt;&lt;STRONG&gt;Lbs Needed&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; after On Hand&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;Dimension&lt;/TD&gt;&lt;TD class="xl64" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;TD class="xl64" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;TD class="xl64" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="96" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;=Sum({&amp;lt;Dt=&lt;BR /&gt;&amp;nbsp; {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;/TD&gt;&lt;TD class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;=SUM(distinct&lt;BR /&gt;&amp;nbsp; Qty*ConvtoLbs)&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="390"&gt;=&lt;BR /&gt;&amp;nbsp; if (&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) &amp;lt; 0 , 0 ,&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) )&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;23&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;PQR&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;52&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;52&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;XYZ&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;72&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;150&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;Totals&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;147&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;152&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;&lt;STRONG style="color: #ff0000;"&gt;-5&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have above chart and the totals are not being calculated correctly . Like above the totals should be calculating as 73 . It does not seems to be recognizing zero from XYZ product and its adding the negative figure (72-150 = -78) to the total and showing 73-78 = -5 as total. I tried using the aggr function and this is what I get after that.&lt;/P&gt;&lt;P&gt;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="976"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" width="73"&gt;&lt;STRONG&gt;ItemKey&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="324"&gt;&lt;STRONG&gt;Lbs Needed &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="189"&gt;&lt;STRONG&gt;On Hand Lbs&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="390"&gt;&lt;STRONG&gt;Lbs Needed&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; after On Hand&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;Dimension&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="96" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;=Sum({&amp;lt;Dt=&lt;BR /&gt;&amp;nbsp; {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;/TD&gt;&lt;TD class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;=SUM(distinct&lt;BR /&gt;&amp;nbsp; Qty*ConvtoLbs)&lt;/TD&gt;&lt;TD class="xl68" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="390"&gt;=&lt;BR /&gt;&amp;nbsp; aggr (if (&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) &amp;lt; 0 , 0 ,&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) ),ItemKey)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;23&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;PQR&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;52&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl69" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt; - &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;XYZ&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;72&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;150&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;Totals&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;147&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;152&lt;/TD&gt;&lt;TD class="xl69" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt; - &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wherever the On Hand Lbs is equal or more than Lbs Needed , I need to show Lbs Needed after on Hand as 0, which I was able to get that if I don't use aggr function but how could I get the totals to appear correctly? Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 16:17:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731224#M1070679</guid>
      <dc:creator />
      <dc:date>2014-08-22T16:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Partial Sums Incorrect on the Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731225#M1070680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;sum(&lt;/STRONG&gt;aggr (if (&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) &amp;lt; 0 , 0 ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) ),ItemKey)&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Hope this helps!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 17:28:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731225#M1070680</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2014-08-22T17:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Partial Sums Incorrect on the Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731226#M1070681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jermiah , that puts in the correct total but in some cases 'Lbs Needed after on Hand' is not being calculated properly. Continuing with the example , I added on more data set to explain further, like for PQR 'Lbs Needed after on Hand' shows 0 instead of showing 52 &lt;/P&gt;&lt;P&gt;&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;&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;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="976"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" width="73"&gt;ItemKey&lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="324"&gt;Lbs Needed &lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="189"&gt;On Hand Lbs&lt;/TD&gt;&lt;TD class="xl65" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="390"&gt;Lbs Needed&lt;BR /&gt;&amp;nbsp; after On Hand&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;Dimension&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;TD class="xl66" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;Expression&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="96" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt; &lt;/TD&gt;&lt;TD class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;=Sum({&amp;lt;Dt=&lt;BR /&gt;&amp;nbsp; {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;/TD&gt;&lt;TD class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;=SUM(distinct&lt;BR /&gt;&amp;nbsp; Qty*ConvtoLbs)&lt;/TD&gt;&lt;TD class="xl68" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="390"&gt;=&lt;BR /&gt;&amp;nbsp; sum(aggr (if (&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) &amp;lt; 0 , 0 ,&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum({&amp;lt;Dt= {"&amp;lt;=$(= Max(Dt))"}&amp;gt;} OrdQty*ConvtoLbs)&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - sum(distinct Qty*ConvtoLbs) ),ItemKey))&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;ABC&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;23&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;21&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;PQR&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;52&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;TD class="xl69" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;XYZ&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;72&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;150&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;STU&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;42&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;42&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="19" style="border-top-color: currentColor; border-top-width: medium; border-top-style: none;"&gt;Totals&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;189&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;152&lt;/TD&gt;&lt;TD class="xl70" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;"&gt;63&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 19:38:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731226#M1070681</guid>
      <dc:creator />
      <dc:date>2014-08-22T19:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Partial Sums Incorrect on the Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731227#M1070682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure, it should be working. Do you have more than one dimension in your chart?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you could, post a sample app that demonstrates the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 19:49:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731227#M1070682</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2014-08-22T19:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Partial Sums Incorrect on the Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731228#M1070683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;did you try taking out the aggr altogether?&lt;/P&gt;&lt;P&gt;if this is a straight table with ItemKey as dimension and other two columns as expression, then the third column can be simply the expression in your original post. for that expression, in total mode, choose sum of rows instead of expression total.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="1.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/65036_1.png" style="width: 620px; height: 528px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 19:51:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731228#M1070683</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-08-22T19:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Partial Sums Incorrect on the Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731229#M1070684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks I converted the chart from pivot table to straight table and sum of rows under Total Mode worked for me &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Aug 2014 20:29:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Partial-Sums-Incorrect-on-the-Expression/m-p/731229#M1070684</guid>
      <dc:creator />
      <dc:date>2014-08-22T20:29:52Z</dc:date>
    </item>
  </channel>
</rss>

