<?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 Pivot Table totals and negative expression values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Pivot-Table-totals-and-negative-expression-values/m-p/230877#M82669</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In most cases (with very few exotic exceptions) the following formula should work just fine:&lt;/P&gt;&lt;P&gt;sum(X*Y)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 May 2010 20:18:52 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2010-05-04T20:18:52Z</dc:date>
    <item>
      <title>Pivot Table totals and negative expression values</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-totals-and-negative-expression-values/m-p/230875#M82667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... do they work?&lt;/P&gt;&lt;P&gt;I've got a Pivot Table with an expression that can produce negative values. The negative values are displayed correctly. The totals however seem to stop working whenever there is a negative value to include, all I get is "-". Totals over only positive values (including 0) work fine.&lt;/P&gt;&lt;P&gt;The expression is something like &lt;I&gt;= Count(x) * y&lt;/I&gt;, where y can be 1, 0 or -1.&lt;/P&gt;&lt;P&gt;What am I doing wrong here?&lt;/P&gt;&lt;P&gt;Edit - just tested this with another expression: &lt;I&gt;= Sum(z)&lt;/I&gt;, where z can be different values (negative as well as positive). And behold: The totals work! Will do some more testing...&lt;/P&gt;&lt;P&gt;Second edit - substituted the first expression &lt;I&gt;= Count(x) * y&lt;/I&gt; with &lt;I&gt;= Sum(y)&lt;/I&gt; which produces the same result plus working totals (and is more elegant even). But I still think the first expression should have worked also.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 May 2010 13:35:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-totals-and-negative-expression-values/m-p/230875#M82667</guid>
      <dc:creator />
      <dc:date>2010-05-04T13:35:26Z</dc:date>
    </item>
    <item>
      <title>Pivot Table totals and negative expression values</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-totals-and-negative-expression-values/m-p/230876#M82668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect the problem is that the pivot table is applying your expression again for the total, but at that point, Y has multiple values, so it can't do the multiplication, so it returns null, displayed as '-'.&lt;/P&gt;&lt;P&gt;Sum(Y) works because it puts Y INSIDE of the aggregation, and thus each ROW only has one value, so it can do the calculation.&lt;/P&gt;&lt;P&gt;If that wasn't an option, you could have used dimensionality() to detect whether you're on that particular subtotal, and substitute the expression you want. Something along these lines for a one-dimensional pivot table with a grand total:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(dimensionality(),count(X)*Y,sum(aggr(count(X)*Y,MyDimension)))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 May 2010 18:33:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-totals-and-negative-expression-values/m-p/230876#M82668</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-05-04T18:33:56Z</dc:date>
    </item>
    <item>
      <title>Pivot Table totals and negative expression values</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-totals-and-negative-expression-values/m-p/230877#M82669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In most cases (with very few exotic exceptions) the following formula should work just fine:&lt;/P&gt;&lt;P&gt;sum(X*Y)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 May 2010 20:18:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-totals-and-negative-expression-values/m-p/230877#M82669</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2010-05-04T20:18:52Z</dc:date>
    </item>
  </channel>
</rss>

