<?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: column total not calculated correct with an if expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/column-total-not-calculated-correct-with-an-if-expression/m-p/1268426#M399255</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;I hope to understand correctly your question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this formula&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14859106499177380 jive_text_macro" jivemacro_uid="_14859106499177380"&gt;
&lt;P&gt;sum(aggr(&lt;/P&gt;
&lt;P&gt;if (&lt;/P&gt;
&lt;P&gt;(sum ({&amp;lt;ProductStatus = {'Active', 'Einde gamma', 'Sample'}, WarehouseName = {'WHS BE','Kontich'}, LocationFunction={'PICKING','BULK'}&amp;gt;} StockQty * SkuPricePurchaseCurrency )-&lt;/P&gt;
&lt;P&gt;(sum ({&amp;lt; ProductStatus = {'Active', 'Einde gamma', 'Sample'}, OrderStatus= {'On hold'},OnHoldReason={'Treated - waiting for client','Treated - waiting for payment','Treated - waiting for payment'}&amp;nbsp;&amp;nbsp; &amp;gt;}&amp;nbsp; OrderQtyOpen*SkuPricePurchaseCurrency) + &lt;/P&gt;
&lt;P&gt;sum ({&amp;lt; ProductStatus = {'Active', 'Einde gamma', 'Sample'}, OrderStatus= {'Placed'}&amp;nbsp; &amp;gt;}&amp;nbsp; OrderQtyOpen*SkuPricePurchaseCurrency))) &amp;lt;0 ,0,&lt;/P&gt;
&lt;P&gt;(sum ({&amp;lt;ProductStatus = {'Active', 'Einde gamma', 'Sample'}, WarehouseName = {'WHS BE','Kontich'}, LocationFunction={'PICKING','BULK'}&amp;gt;} StockQty * SkuPricePurchaseCurrency )-&lt;/P&gt;
&lt;P&gt;(sum ({&amp;lt; ProductStatus = {'Active', 'Einde gamma', 'Sample'}, OrderStatus= {'On hold'},OnHoldReason={'Treated - waiting for client','Treated - waiting for payment','Treated - waiting for payment'}&amp;nbsp;&amp;nbsp; &amp;gt;}&amp;nbsp; OrderQtyOpen*SkuPricePurchaseCurrency) + &lt;/P&gt;
&lt;P&gt;sum ({&amp;lt; ProductStatus = {'Active', 'Einde gamma', 'Sample'}, OrderStatus= {'Placed'}&amp;nbsp; &amp;gt;}&amp;nbsp; OrderQtyOpen*SkuPricePurchaseCurrency)))&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;, ProductGroupLevel1, ProductGroupLevel2, SkuCode))&lt;/STRONG&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Luca Jonathan Panetta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Feb 2017 00:58:02 GMT</pubDate>
    <dc:creator>pljsoftware</dc:creator>
    <dc:date>2017-02-01T00:58:02Z</dc:date>
    <item>
      <title>column total not calculated correct with an if expression</title>
      <link>https://community.qlik.com/t5/QlikView/column-total-not-calculated-correct-with-an-if-expression/m-p/1268425#M399254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have a pivot table where the 2 last columns are used to calculate free stock.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"free stock" is to decide if there is too much stock or not enough on sku level.&lt;/P&gt;&lt;P&gt;"free stock not zero" is to calculate the excess stock in total, how much stock do i have that i will end up with if i don't get extra orders.&lt;/P&gt;&lt;P&gt;For this calculation i don't want to take -1000 for reference B into consideration because it would lower the excess stock incorrectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example if i have 2 references and "free stock" for reference A= 1000 en for reference B = -1000,&lt;/P&gt;&lt;P&gt;for "free stock not zero" it should say 0 for reference B .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To do that i used an if statement to check if free stock is lower then zero it should give me a zero, otherwise the amount of free stock.&lt;/P&gt;&lt;P&gt;The expression gives a correct value on the SKU level, but the sum for the colum does not calculate correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody have an idea how this is possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it attached an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanx!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;grtz,&lt;/P&gt;&lt;P&gt;chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 22:32:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/column-total-not-calculated-correct-with-an-if-expression/m-p/1268425#M399254</guid>
      <dc:creator>chriscools</dc:creator>
      <dc:date>2017-01-31T22:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: column total not calculated correct with an if expression</title>
      <link>https://community.qlik.com/t5/QlikView/column-total-not-calculated-correct-with-an-if-expression/m-p/1268426#M399255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;I hope to understand correctly your question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this formula&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14859106499177380 jive_text_macro" jivemacro_uid="_14859106499177380"&gt;
&lt;P&gt;sum(aggr(&lt;/P&gt;
&lt;P&gt;if (&lt;/P&gt;
&lt;P&gt;(sum ({&amp;lt;ProductStatus = {'Active', 'Einde gamma', 'Sample'}, WarehouseName = {'WHS BE','Kontich'}, LocationFunction={'PICKING','BULK'}&amp;gt;} StockQty * SkuPricePurchaseCurrency )-&lt;/P&gt;
&lt;P&gt;(sum ({&amp;lt; ProductStatus = {'Active', 'Einde gamma', 'Sample'}, OrderStatus= {'On hold'},OnHoldReason={'Treated - waiting for client','Treated - waiting for payment','Treated - waiting for payment'}&amp;nbsp;&amp;nbsp; &amp;gt;}&amp;nbsp; OrderQtyOpen*SkuPricePurchaseCurrency) + &lt;/P&gt;
&lt;P&gt;sum ({&amp;lt; ProductStatus = {'Active', 'Einde gamma', 'Sample'}, OrderStatus= {'Placed'}&amp;nbsp; &amp;gt;}&amp;nbsp; OrderQtyOpen*SkuPricePurchaseCurrency))) &amp;lt;0 ,0,&lt;/P&gt;
&lt;P&gt;(sum ({&amp;lt;ProductStatus = {'Active', 'Einde gamma', 'Sample'}, WarehouseName = {'WHS BE','Kontich'}, LocationFunction={'PICKING','BULK'}&amp;gt;} StockQty * SkuPricePurchaseCurrency )-&lt;/P&gt;
&lt;P&gt;(sum ({&amp;lt; ProductStatus = {'Active', 'Einde gamma', 'Sample'}, OrderStatus= {'On hold'},OnHoldReason={'Treated - waiting for client','Treated - waiting for payment','Treated - waiting for payment'}&amp;nbsp;&amp;nbsp; &amp;gt;}&amp;nbsp; OrderQtyOpen*SkuPricePurchaseCurrency) + &lt;/P&gt;
&lt;P&gt;sum ({&amp;lt; ProductStatus = {'Active', 'Einde gamma', 'Sample'}, OrderStatus= {'Placed'}&amp;nbsp; &amp;gt;}&amp;nbsp; OrderQtyOpen*SkuPricePurchaseCurrency)))&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;, ProductGroupLevel1, ProductGroupLevel2, SkuCode))&lt;/STRONG&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Luca Jonathan Panetta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2017 00:58:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/column-total-not-calculated-correct-with-an-if-expression/m-p/1268426#M399255</guid>
      <dc:creator>pljsoftware</dc:creator>
      <dc:date>2017-02-01T00:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: column total not calculated correct with an if expression</title>
      <link>https://community.qlik.com/t5/QlikView/column-total-not-calculated-correct-with-an-if-expression/m-p/1268427#M399256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry for the late reply, but this&amp;nbsp; was indeed the answer!&lt;/P&gt;&lt;P&gt;thank you for your help!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;grtz,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 20:43:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/column-total-not-calculated-correct-with-an-if-expression/m-p/1268427#M399256</guid>
      <dc:creator>chriscools</dc:creator>
      <dc:date>2017-02-09T20:43:52Z</dc:date>
    </item>
  </channel>
</rss>

