<?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 Total Problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158560#M33586</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a pivot table with a few dimensions and one expression. The expression is something like:&lt;/P&gt;&lt;P&gt;if(field = 'R',-Sum(sales),Sum(Sales))&lt;/P&gt;&lt;P&gt;The detail in the pivot table show the negative numbers properly. However the "Total" amount in the pivot table is not taking into account that some amounts are negative and is showing the total as if all number are a positive number.&lt;/P&gt;&lt;P&gt;Any Ideas what is wrong?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Aug 2009 04:37:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-08-15T04:37:41Z</dc:date>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158560#M33586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a pivot table with a few dimensions and one expression. The expression is something like:&lt;/P&gt;&lt;P&gt;if(field = 'R',-Sum(sales),Sum(Sales))&lt;/P&gt;&lt;P&gt;The detail in the pivot table show the negative numbers properly. However the "Total" amount in the pivot table is not taking into account that some amounts are negative and is showing the total as if all number are a positive number.&lt;/P&gt;&lt;P&gt;Any Ideas what is wrong?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 04:37:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158560#M33586</guid>
      <dc:creator />
      <dc:date>2009-08-15T04:37:41Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158561#M33587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On the expressions tab, change the total mode to sum of rows. The default is "expression total", but since you have multiple values for your field, field = null. Null does not equal 'R', so it chooses just sum(Sales) for your total value, which is of course not what you wanted. Summing up the rows instead should solve the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 04:51:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158561#M33587</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-08-15T04:51:37Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158562#M33588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is grayed out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 05:01:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158562#M33588</guid>
      <dc:creator />
      <dc:date>2009-08-15T05:01:41Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158563#M33589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh, right, pivot table. This should work, then, as it essentially manually sums up the rows inside of the expression, which is what we wanted to do by selecting sum of rows.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum(Sales * if(field='R',-1,1))&lt;/P&gt;&lt;P&gt;Or like a normal person might write it:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum(if(field='R',-sales,sales))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 05:30:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158563#M33589</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-08-15T05:30:29Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158564#M33590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If "field" is part of the table&lt;/P&gt;&lt;P&gt;if(field = 'R',-Sum(sales),Sum(Sales))&lt;/P&gt;&lt;P&gt;would work fine, if not&lt;/P&gt;&lt;P&gt;sum(Sales * if(field='R',-1,1))&lt;/P&gt;&lt;P&gt;will do&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;like john said, but 1st option will misscalculate the total row&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C ya!&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2009 05:41:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158564#M33590</guid>
      <dc:creator>hector</dc:creator>
      <dc:date>2009-08-15T05:41:01Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158565#M33591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason for the miscalculation is because the "field" is not uniquely defined at the total level. Hector's second formula should work fine, however might be heavy on a large data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd recommend calculating the corresponding "flag" in the script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(field = 'R', -1, 1) as SalesMult&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression = sum(Sales * SalesMult)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2009 11:07:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158565#M33591</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2009-08-17T11:07:15Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158566#M33592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or avoid the on the fly IF or multiplication entirely:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(field='R',-sales,sales) as SignedSales&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;expression = sum(SignedSales)&lt;/P&gt;&lt;P&gt;Compression should keep that from causing any memory problems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 03:12:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158566#M33592</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-08-18T03:12:04Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158567#M33593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look at the attached document and my note. What is happening?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Stephen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 22:43:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158567#M33593</guid>
      <dc:creator />
      <dc:date>2009-08-18T22:43:30Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158568#M33594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;Out of curiosity can you try the following in the script, I had a similar problem a while back....&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;SalesDocItem_temp:&lt;BR /&gt;LOAD&lt;BR /&gt;[Subtotal 6_KZWI6] as OrderAmount,&lt;BR /&gt;MaterialNumber_Key,&lt;BR /&gt;SalesDocument_Key&lt;BR /&gt;FROM &lt;Q&gt; (qvd)&lt;BR /&gt;Where MaterialNumber_Key ='000000037000002000';&lt;/Q&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;concatenate&lt;BR /&gt;LOAD&lt;BR /&gt;[Sales doc.type_AUART] as OrderType,&lt;BR /&gt;[Document date_AUDAT] as DocumentDate,&lt;BR /&gt;SalesDocument_Key&lt;BR /&gt;FROM &lt;Q&gt; (qvd);&lt;/Q&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;SalesDocItem:&lt;BR /&gt;NOCONCATENATE LOAD&lt;BR /&gt;SalesDocument_Key,&lt;BR /&gt;OrderAmount,&lt;BR /&gt;MaterialNumber_Key,&lt;BR /&gt;OrderType,&lt;BR /&gt;DocumentDate&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;RESIDENT SalesDocItem;&lt;/P&gt;&lt;P style="margin:0cm 0cm 10pt;"&gt;DROP table SalesDocItem_temp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 23:04:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158568#M33594</guid>
      <dc:creator />
      <dc:date>2009-08-18T23:04:31Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158569#M33595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Getting an error NoConcatenate part. Says table not found SalesDociItem etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 23:40:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158569#M33595</guid>
      <dc:creator />
      <dc:date>2009-08-18T23:40:10Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158570#M33596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I dont know, but the resident should be from SalesDocItem_temp or not?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c ya&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 23:48:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158570#M33596</guid>
      <dc:creator>hector</dc:creator>
      <dc:date>2009-08-18T23:48:54Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158571#M33597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I changed it and am still getting an error. I'll keep looking at.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2009 23:54:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158571#M33597</guid>
      <dc:creator />
      <dc:date>2009-08-18T23:54:10Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158572#M33598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the same error about noconcatenate?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2009 00:08:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158572#M33598</guid>
      <dc:creator>hector</dc:creator>
      <dc:date>2009-08-19T00:08:32Z</dc:date>
    </item>
    <item>
      <title>Pivot Table Total Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158573#M33599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, different error, but I got the script to work and unfortunately it did not fix the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2009 00:19:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Table-Total-Problem/m-p/158573#M33599</guid>
      <dc:creator />
      <dc:date>2009-08-19T00:19:22Z</dc:date>
    </item>
  </channel>
</rss>

