<?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: How to ignore negative values in a Pivot Table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269920#M496222</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if their are negatives in both col1 and col2 then you might want to qualify that in your if statement instead. Since multiplying them together would give you a positive number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(if(col1&amp;lt;0 or col2&amp;lt;0,0,col1*col2))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Dec 2011 14:07:58 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-12-01T14:07:58Z</dc:date>
    <item>
      <title>How to ignore negative values in a Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269915#M496217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello; I am new to the QlickView application and I am facing an issue that should be pretty simple to resolve, however, so far I was unable to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a simple example of what I would like to accomplish; I have 2 tables with the following data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 1%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;TBL1.Col1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;-5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="93" style="border: 1px solid #000000; width: 69px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;TBL2.Col2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Pivot Table with ID as Dimension and with expressions: Sum(TBL1.Col1*TBL2.Col2). My Pivot table show like this:&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 10%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;ColA&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While this is mathematically correct of course, my particular need is to ignore the negative value while processing the rest of the rows so that my result would be &lt;STRONG&gt;80 &lt;/STRONG&gt;in case of &lt;STRONG&gt;ID1&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried the following, but it does not give me the result I want: &lt;SPAN style="font-family: courier new,courier;"&gt;If (Sum(Col1*Col2)&amp;gt;0, Sum(Col1*Col2), 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;For all the negative value I would get a 0, whereas if I have no negative values I would get the correct result as seen below:&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 10%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;ColA&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I would like to avoid using an IF condition in the SQL statement, as those numbers may be included in another straight Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions would be extremely appreciated; thank you in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 20:02:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269915#M496217</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-11-30T20:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore negative values in a Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269916#M496218</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;&lt;/P&gt;&lt;P&gt;First I think you need to merge your 2 table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="125"&gt;&lt;TBODY&gt;&lt;TR style="height: 14.25pt;"&gt;&lt;TD class="xl63" height="19" style="height: 14.25pt; width: 28pt;" width="37"&gt;ID&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; width: 33pt;" width="44"&gt;Col1&lt;/TD&gt;&lt;TD class="xl63" style="border-left: medium none; width: 33pt;" width="44"&gt;Col2&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 14.25pt;"&gt;&lt;TD class="xl64" height="19" style="height: 14.25pt; border-top: medium none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;-5&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 14.25pt;"&gt;&lt;TD class="xl64" height="19" style="height: 14.25pt; border-top: medium none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;10&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 14.25pt;"&gt;&lt;TD class="xl64" height="19" style="height: 14.25pt; border-top: medium none;"&gt;1&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;20&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 14.25pt;"&gt;&lt;TD class="xl64" height="19" style="height: 14.25pt; border-top: medium none;"&gt;2&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;5&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 14.25pt;"&gt;&lt;TD class="xl64" height="19" style="height: 14.25pt; border-top: medium none;"&gt;2&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;10&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 14.25pt;"&gt;&lt;TD class="xl64" height="19" style="height: 14.25pt; border-top: medium none;"&gt;2&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;20&lt;/TD&gt;&lt;TD class="xl64" style="border-top: medium none; border-left: medium none;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at the attachement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then just use for expression&lt;/P&gt;&lt;P&gt;=sum(&amp;nbsp;&amp;nbsp;&amp;nbsp; if(&amp;nbsp;&amp;nbsp; Col1*Col2 &amp;gt; 0 , Col1 * Col2 , 0))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 21:04:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269916#M496218</guid>
      <dc:creator />
      <dc:date>2011-11-30T21:04:17Z</dc:date>
    </item>
    <item>
      <title>How to ignore negative values in a Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269917#M496219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could try sum(if(col1*col2&amp;lt;0,0,col1*col2))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 21:48:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269917#M496219</guid>
      <dc:creator />
      <dc:date>2011-11-30T21:48:20Z</dc:date>
    </item>
    <item>
      <title>How to ignore negative values in a Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269918#M496220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had 3 cases out of 11 where I had negative values that needed to be ignored; I've used your expression... and it works in 2 cases.&lt;/P&gt;&lt;P&gt;I'll have to look at the data for the remaining case that still gives me problems, as I feel this may be related to the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS JJ, thank you for the reply; I will try your advice as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 02:57:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269918#M496220</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-01T02:57:48Z</dc:date>
    </item>
    <item>
      <title>How to ignore negative values in a Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269919#M496221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can also use rangemax(Sum(TBL1.Col1*TBL2.Col2),0)&lt;/P&gt;&lt;P&gt;which will solve ur problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 06:47:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269919#M496221</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-01T06:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore negative values in a Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269920#M496222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if their are negatives in both col1 and col2 then you might want to qualify that in your if statement instead. Since multiplying them together would give you a positive number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(if(col1&amp;lt;0 or col2&amp;lt;0,0,col1*col2))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 14:07:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269920#M496222</guid>
      <dc:creator />
      <dc:date>2011-12-01T14:07:58Z</dc:date>
    </item>
    <item>
      <title>How to ignore negative values in a Pivot Table</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269921#M496223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got it working; the last piece was a problem with the data. Once that was rectified... it works perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my first interaction with this fine community, and I have to say it, I am very impressed with the knowledge and the willingness to help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much everyone; much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 16:53:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-negative-values-in-a-Pivot-Table/m-p/269921#M496223</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-01T16:53:42Z</dc:date>
    </item>
  </channel>
</rss>

