<?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: Double counting of values with Group by function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422225#M612370</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brandon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you're mixing up your keys (or I'm not getting it...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="php" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15088487722722583" jivemacro_uid="_15088487722722583" modifiedtitle="true"&gt;
&lt;P&gt;table123:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; POitemKey, Qty, TrueKey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4500803485|00010, -5, 2016|5000200614|0001&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4500803485|00010, 5, 2016|5000200613|0001&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4500803485|00010, 5, 2016|5000208014|0001&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;POReceived:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;POitemKey as POitemKey_Open,&lt;/P&gt;
&lt;P&gt;Qty as QtyReceived,&lt;/P&gt;
&lt;P&gt;TrueKey as Key&lt;/P&gt;
&lt;P&gt;Resident table123;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;POReceived2:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;POitemKey_Open,&lt;/P&gt;
&lt;P&gt;Sum(QtyReceived) as QtyFinal&lt;/P&gt;
&lt;P&gt;RESIDENT POReceived&lt;/P&gt;
&lt;P&gt;Group by POitemKey_Open;&lt;/P&gt;
&lt;P&gt;drop table POReceiv&lt;SPAN style="font-size: 13.3333px;"&gt;ed;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;produces:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Naamloos.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/180733_Naamloos.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which is what I reckon you were trying to achieve, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the attached demo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With kind regards,&lt;/P&gt;&lt;P&gt;Ronald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Oct 2017 12:40:59 GMT</pubDate>
    <dc:creator>RonaldDoes</dc:creator>
    <dc:date>2017-10-24T12:40:59Z</dc:date>
    <item>
      <title>Double counting of values with Group by function</title>
      <link>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422224#M612369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to group by purchase orders to count the total qty.&lt;/P&gt;&lt;P&gt;The results are double counting.&lt;/P&gt;&lt;P&gt;I have a unique key for each row and have tried autonumber, both have failed in reducing the duplication.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Issue:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;result should be Qty 5.&lt;/P&gt;&lt;P&gt;Group by incorrectly return Qty 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Raw data:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="418"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="220"&gt;POitemKey&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="75"&gt;Qty&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="123"&gt;TrueKey&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;4500803485|00010&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;-5&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2016|5000200614|0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;4500803485|00010&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2016|5000200613|0001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;4500803485|00010&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;2016|5000208014|0001&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Group by code...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;POReceived:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;POitemKey as POitemKey_Open,&lt;/P&gt;&lt;P&gt;Qty as QtyReceived,&lt;/P&gt;&lt;P&gt;Key &lt;/P&gt;&lt;P&gt;From table123&lt;/P&gt;&lt;P&gt;Where [MVT_Type]='101' OR [MVT_Type]='102'; //receipts and returns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;POReceived2:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;POitemKey,&lt;/P&gt;&lt;P&gt;Sum(Qty) as QtyFinal&lt;/P&gt;&lt;P&gt;RESIDENT POReceived&lt;/P&gt;&lt;P&gt;Group by POitemKey;&lt;/P&gt;&lt;P&gt;drop table POReceived;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Results after groupby&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 210px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="117"&gt;POitemKey&lt;/TD&gt;&lt;TD class="xl63" style="border-left: none;" width="93"&gt;QtyFinal&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl64" height="17" style="border-top: none;"&gt;4500803485|00010&lt;/TD&gt;&lt;TD class="xl64" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Math...[=5+5+(-5) = 5]&lt;/SPAN&gt;Result should be QtyFinal = 5. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also tried autonumber.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;&lt;STRONG style="text-decoration: underline;"&gt;Please any suggestions are greatly appreciated!!!&lt;/STRONG&gt;&lt;/H2&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 12:33:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422224#M612369</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-24T12:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Double counting of values with Group by function</title>
      <link>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422225#M612370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brandon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you're mixing up your keys (or I'm not getting it...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="php" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15088487722722583" jivemacro_uid="_15088487722722583" modifiedtitle="true"&gt;
&lt;P&gt;table123:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; POitemKey, Qty, TrueKey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4500803485|00010, -5, 2016|5000200614|0001&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4500803485|00010, 5, 2016|5000200613|0001&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4500803485|00010, 5, 2016|5000208014|0001&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;POReceived:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;POitemKey as POitemKey_Open,&lt;/P&gt;
&lt;P&gt;Qty as QtyReceived,&lt;/P&gt;
&lt;P&gt;TrueKey as Key&lt;/P&gt;
&lt;P&gt;Resident table123;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;POReceived2:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;POitemKey_Open,&lt;/P&gt;
&lt;P&gt;Sum(QtyReceived) as QtyFinal&lt;/P&gt;
&lt;P&gt;RESIDENT POReceived&lt;/P&gt;
&lt;P&gt;Group by POitemKey_Open;&lt;/P&gt;
&lt;P&gt;drop table POReceiv&lt;SPAN style="font-size: 13.3333px;"&gt;ed;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;produces:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Naamloos.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/180733_Naamloos.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which is what I reckon you were trying to achieve, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the attached demo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With kind regards,&lt;/P&gt;&lt;P&gt;Ronald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Oct 2017 12:40:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422225#M612370</guid>
      <dc:creator>RonaldDoes</dc:creator>
      <dc:date>2017-10-24T12:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Double counting of values with Group by function</title>
      <link>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422226#M612371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ronald,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with your example and it does work with the inline statement, but something weird is happening.&amp;nbsp; Here is an example.&amp;nbsp; Every time I try to sum the quantities or group by, it does not add properly. &lt;/P&gt;&lt;P&gt;Things I have tried:&lt;/P&gt;&lt;P&gt;1) Store the table and open in a new session of qlikview.&lt;/P&gt;&lt;P&gt;2) Format Qty field while loading as a num() to ensure that the negative sign is not affecting it.&lt;/P&gt;&lt;P&gt;3) NoConcatenate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only thing I can get to work is Set Analysis.&lt;/P&gt;&lt;P&gt;sum(Qty) always seems to double the counts which doesn't make sense because the field 'Key' is a perfect Key.&lt;/P&gt;&lt;P&gt;If I group by below and sum qty I would expect to get 5.&amp;nbsp; But that does not happen.&amp;nbsp; Very odd.&lt;/P&gt;&lt;P&gt;Yet if I load inline as you show, it does work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Example.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/180908_Example.PNG" style="height: 220px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help,&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 14:54:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422226#M612371</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T14:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Double counting of values with Group by function</title>
      <link>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422227#M612372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brandon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect your source table has duplicate entries.&lt;/P&gt;&lt;P&gt;Can you load them with RecNo() to ensure every row is unique?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See: &lt;A href="https://community.qlik.com/thread/73366"&gt;rowno() and recno()&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With kind regards,&lt;/P&gt;&lt;P&gt;Ronald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 15:05:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Double-counting-of-values-with-Group-by-function/m-p/1422227#M612372</guid>
      <dc:creator>RonaldDoes</dc:creator>
      <dc:date>2017-10-25T15:05:19Z</dc:date>
    </item>
  </channel>
</rss>

