<?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: sum problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472671#M176490</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The set is calculated per chart, not per row or record. The if statement is not having any effect on that. So sum({&amp;lt;FAMILY={10}&amp;gt;}QTY) will return 180 and not 150. &lt;SPAN style="font-size: 10pt;"&gt;Try this instead: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;sum({&amp;lt;FAMILY={10}&amp;gt;}ACTUAL_QTY)/sum({&amp;lt;FAMILY={10},&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;ACTUAL_QTY-={0}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;gt;}QTY)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 19 May 2013 18:59:26 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-05-19T18:59:26Z</dc:date>
    <item>
      <title>sum problem</title>
      <link>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472670#M176489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;G'day,&lt;/P&gt;&lt;P&gt;I have a problem that I don't understand.&lt;/P&gt;&lt;P&gt;I have a table that show the quantity that have to be collected (QTY) and the the actual qty that was collected (QTY_ACTUAL) the products are divided to families and I want to callulate onlt family 10 that was actually collected.&lt;/P&gt;&lt;P&gt;The data is&lt;/P&gt;&lt;P&gt;FAMILY, QTY, ACTUAL_QTY&lt;/P&gt;&lt;P&gt;10,100,80&lt;/P&gt;&lt;P&gt;20,50,50&lt;/P&gt;&lt;P&gt;10,30,0&lt;/P&gt;&lt;P&gt;10,50,20&lt;/P&gt;&lt;P&gt;the result should be 100 / 150 = 66%&lt;/P&gt;&lt;P&gt;I'm using the following statement&lt;/P&gt;&lt;P&gt;SUM&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;FAMILY&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={'10'}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;QTY_ACTUAL&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: #0000ff; font-size: 8pt;"&gt;SUM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;FAMILY&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={'10'}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;QTY_ACTUAL&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) = 0,0,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;SUM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;FAMILY&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={'10'}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;QTY&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;My problem is that it calculate it as 10 / 180 and give me 55.55%&lt;/P&gt;&lt;P&gt;any help will be appreciated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yaniv&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 May 2013 18:44:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472670#M176489</guid>
      <dc:creator>egoziyan</dc:creator>
      <dc:date>2013-05-19T18:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: sum problem</title>
      <link>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472671#M176490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The set is calculated per chart, not per row or record. The if statement is not having any effect on that. So sum({&amp;lt;FAMILY={10}&amp;gt;}QTY) will return 180 and not 150. &lt;SPAN style="font-size: 10pt;"&gt;Try this instead: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;sum({&amp;lt;FAMILY={10}&amp;gt;}ACTUAL_QTY)/sum({&amp;lt;FAMILY={10},&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;ACTUAL_QTY-={0}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;gt;}QTY)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 May 2013 18:59:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472671#M176490</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-05-19T18:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: sum problem</title>
      <link>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472672#M176491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks you &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/gwassenaar" id="jive-9654422410557167663180" onmouseout="" onmouseover=""&gt;Gysbert&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Can you explain to me the&lt;/P&gt;&lt;P&gt;/sum({&amp;lt;FAMILY={10},&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;ACTUAL_QTY-={0}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;gt;}QTY)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;part as it gives me the wrong answer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;In my example I'm getting 80 + 20 = 100 which is the actual qty rather then 100+50 = 150&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;it also give me red underline from the -= sign (like an error in the syntax)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Yaniv&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2013 14:49:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472672#M176491</guid>
      <dc:creator>egoziyan</dc:creator>
      <dc:date>2013-05-20T14:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: sum problem</title>
      <link>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472673#M176492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do get the correct answer 150 with Gysbert's solution. Have you double checked that your expression is identical?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The red underline is an error in the syntax checker (it doesn't recognize the -= operator properly), which you can ignore in this case. The status of the expression dialog should say 'Syntax ok'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also use this, should be equivalent to above:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; sum({&amp;lt;FAMILY={10}, ACTUAL_QTY = {"&amp;lt;&amp;gt;0"}&amp;gt;} QTY)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2013 15:20:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-problem/m-p/472673#M176492</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-05-20T15:20:27Z</dc:date>
    </item>
  </channel>
</rss>

