<?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: Positive and Negative Quantities in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561564#M687458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code is not doing what you stated....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to your statement you want to implement the exact same logic regardless of TranType...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;For Transaction 17 (Credits), &lt;STRONG&gt;if there is a positive quanity and a negative price, I need to turn that positive quantity to a negative quantity.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;For Transaction 1 (Invoices) &lt;STRONG&gt;if there is a positive quanity and a negative price, I need to turn that positive quantity to a negative quantity.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Anywhere you would use &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 11px;"&gt;DET_Qty&lt;/SPAN&gt;, replace with this....&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if (&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 11px;"&gt;DET_Amount&lt;/SPAN&gt;&amp;lt;0 and &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 11px;"&gt;DET_Qty&lt;/SPAN&gt;&amp;gt;0, &lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;*(-1)&lt;/SPAN&gt;, &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 11px;"&gt;DET_Qty&lt;/SPAN&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Dec 2013 15:18:55 GMT</pubDate>
    <dc:creator>wallinpeter</dc:creator>
    <dc:date>2013-12-11T15:18:55Z</dc:date>
    <item>
      <title>Positive and Negative Quantities</title>
      <link>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561563#M687456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am pulling invoices and credits from my SQL table called Details; 1 is an invoice and 17 is a credit and storing into a QVD. Then I want to perform certain calculations before gathering it all into a Transactions QVD later in the script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Transaction 17 (Credits), if there is a positive quanity and a negative price, I need to turn that positive quantity to a negative quantity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Transaction 1 (Invoices) if there is a positive quanity and a negative price, I need to turn that positive quantity to a negative quantity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the original script written by someone else. Is this correct? Is there a better way to write this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;//Transaction Details - Pulls Invoices and Credits Only&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;SQL&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; SELECT *&lt;BR /&gt;FROM "TirePower".dbo.Details&lt;BR /&gt;WHERE [DET_TransTypeID]=1 or&lt;BR /&gt; [DET_TransTypeID]=17;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Store&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; Detail &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Into&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; C:\QlikView\QlikView Development\QVDocuments\SourceDocuments\QVD\TS\Detail.qvd (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;qvd&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Detail_Calc:&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;//Calculates Negative QTY and Gross Revenue - Use this one for building document&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;NoConcatenate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Load&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; * ,&lt;BR /&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_TransTypeID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=1, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;*(-1))) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_NetQty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;//This makes Refunds and Credits Negative Qty's.&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; ((&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_FET&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; * (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_TransTypeID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=1, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;* (-1)))) + &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Amount&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) -&lt;BR /&gt; ((&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_FET&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; * (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_TransTypeID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=1, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;* (-1)))) + (&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_UnitCostLast&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;*(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_TransTypeID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;=1, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;* (-1))))) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;GrossRev&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Resident&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; Detail&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Where&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Match&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;DET_TransTypeID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 1, 17)&amp;gt;0;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Store&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; * &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; Detail_Calc &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Into&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; C:\QlikView\QlikView Development\QVDocuments\SourceDocuments\QVD\TS\Detail_Calc.qvd (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;qvd&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Drop&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; Detail;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Drop&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Table&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; Detail_Calc; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 14:56:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561563#M687456</guid>
      <dc:creator>jenmclean</dc:creator>
      <dc:date>2013-12-11T14:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Positive and Negative Quantities</title>
      <link>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561564#M687458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code is not doing what you stated....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to your statement you want to implement the exact same logic regardless of TranType...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;For Transaction 17 (Credits), &lt;STRONG&gt;if there is a positive quanity and a negative price, I need to turn that positive quantity to a negative quantity.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;For Transaction 1 (Invoices) &lt;STRONG&gt;if there is a positive quanity and a negative price, I need to turn that positive quantity to a negative quantity.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Anywhere you would use &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 11px;"&gt;DET_Qty&lt;/SPAN&gt;, replace with this....&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if (&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 11px;"&gt;DET_Amount&lt;/SPAN&gt;&amp;lt;0 and &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 11px;"&gt;DET_Qty&lt;/SPAN&gt;&amp;gt;0, &lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;*(-1)&lt;/SPAN&gt;, &lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 11px;"&gt;DET_Qty&lt;/SPAN&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 15:18:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561564#M687458</guid>
      <dc:creator>wallinpeter</dc:creator>
      <dc:date>2013-12-11T15:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Positive and Negative Quantities</title>
      <link>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561565#M687459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you, I knew there was a better way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jennie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 16:23:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561565#M687459</guid>
      <dc:creator>jenmclean</dc:creator>
      <dc:date>2013-12-11T16:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Positive and Negative Quantities</title>
      <link>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561566#M687460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having one further issue with this problem. My two parts of the code are below plus a screen shot of the exported data. Part 1 shows the updated formula that Peter suggested which has been validated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PART 2 shows the formula's for calculating specific items. The screenshot shows an example of a calculation not working properly which then puts my numbers off for that day. We narrowed it down to a specific invoice which is showing in the screen shot. See notes on screen shot...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to handle this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PART 1 (from Peter's response)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Detail: //Transaction Details - Pulls Invoices and Credits Only&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "TirePower-SchierlTire_WI".dbo.Details&lt;/P&gt;&lt;P&gt;WHERE [DET_TransTypeID]=1 or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; [DET_TransTypeID]=17;&lt;/P&gt;&lt;P&gt;Store * FROM Detail Into C:\QlikView\QlikView Development\QVDocuments\SourceDocuments\QVD\TS\Detail.qvd (qvd);&lt;/P&gt;&lt;P&gt;&amp;nbsp; Detail_Calc:&amp;nbsp; //Calculates Negative QTY and Gross Revenue - Use this one for building document&lt;/P&gt;&lt;P&gt;&amp;nbsp; NoConcatenate Load * ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt; if(DET_Amount &amp;lt; 0 and DET_Qty &amp;gt; 0, DET_Qty*(-1), DET_Qty) as DET_NetQty&amp;nbsp; //New Forumula for Negative Quantity 12/11/13; validated&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PART 2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//******Calculations******&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Gross Revenue and Targets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numSum(DET_NetQty) as TARGET|BaseUnitsSold,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numSum(DET_NetQty) * 1.15 as TARGET|StretchUnitsSold,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Cost and Price Calculations&lt;/P&gt;&lt;P&gt;&amp;nbsp; (DET_FET + DET_UnitCostLast) as TP|UnitCost,&lt;/P&gt;&lt;P&gt;&amp;nbsp; ((DET_Amount/DET_NetQty) + DET_FET) as TP|UnitPrice,&lt;/P&gt;&lt;P&gt;&amp;nbsp; (DET_FET + DET_UnitCostLast) * DET_NetQty as TP|Ext.Cost, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (DET_FET * DET_NetQty) + DET_Amount as TP|Ext.Price,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((DET_FET * DET_NetQty) + DET_Amount)- ((DET_FET + DET_UnitCostLast) * DET_NetQty)) as GR|Final,&amp;nbsp; //Ext.Price-Ext.Cost * NetQty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (((DET_FET * DET_NetQty) + DET_Amount)- ((DET_FET + DET_UnitCostLast) * DET_NetQty)) * 1.15 as TARGET|StretchRevenue,&amp;nbsp; //Ext.Price-Ext.Cost * NetQty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Margin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Num((((DET_FET) * DET_NetQty + DET_Amount) - ((DET_FET + DET_UnitCostLast) * DET_NetQty)) / ((DET_FET) * DET_NetQty + DET_Amount),'#,##0.00%') as TP|Margin&amp;nbsp; //Ext.Price - Ext.Cost / Ext.Price&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="qv-calculation.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/50516_qv-calculation.png" style="width: 620px; height: 187px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 17:03:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561566#M687460</guid>
      <dc:creator>jenmclean</dc:creator>
      <dc:date>2013-12-16T17:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Positive and Negative Quantities</title>
      <link>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561567#M687461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure I understand equations. If Ext.Price = UnitPrice - Ext.Cost, then...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shouldn't Ext.Price be....&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;(((DET_Amount/DET_NetQty) + DET_FET)) - (&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;(DET_FET + DET_UnitCostLast) * DET_NetQty)&lt;/STRONG&gt;&lt;/SPAN&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;STRONG&gt;&lt;BR /&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;or am I missing something&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Dec 2013 17:22:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561567#M687461</guid>
      <dc:creator>wallinpeter</dc:creator>
      <dc:date>2013-12-16T17:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Positive and Negative Quantities</title>
      <link>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561568#M687462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I beleive the issue is due to the Invoice Amount&amp;nbsp; (DET_Amount) being $0.00. This example is for an oil change which has the line item for the oil used in the service (for invnentory) but since it is part of a package the $ amount is not included on that line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, TP|Ext.Cost needs to be negative if there is a $0.00 in DET_Amount which should then make GR|Final a positive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The rest of the line items on this credit are correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does that make more sense?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 19:19:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561568#M687462</guid>
      <dc:creator>jenmclean</dc:creator>
      <dc:date>2013-12-18T19:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Positive and Negative Quantities</title>
      <link>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561569#M687463</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;if (&lt;/SPAN&gt;&lt;SPAN style="font-size: 11px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;&lt;STRONG&gt;DET_Amount&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;STRONG&gt;&amp;lt;=0&lt;/STRONG&gt; and &lt;/SPAN&gt;&lt;SPAN style="font-size: 11px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;gt;0, &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;*(-1)&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 11px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;DET_Qty&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 19:57:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Positive-and-Negative-Quantities/m-p/561569#M687463</guid>
      <dc:creator>wallinpeter</dc:creator>
      <dc:date>2013-12-18T19:57:42Z</dc:date>
    </item>
  </channel>
</rss>

