<?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: The sum function in aggregation is giving wrong results in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057809#M86875</link>
    <description>&lt;P&gt;I tried this formula now the result is empty. This is my actual column names&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=Sum(Aggr(sum(distinct GNT_QS_PREM),GNT_Class_Code,GNT_SC_Code))&lt;/P&gt;
&lt;P&gt;Formula is showing OK&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But no result set&lt;/P&gt;
&lt;P&gt;Check the screenshot attached.&lt;/P&gt;
&lt;P&gt;1. Expression Formula&lt;/P&gt;
&lt;P&gt;2. Straight Table Data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 07:19:16 GMT</pubDate>
    <dc:creator>pashok75</dc:creator>
    <dc:date>2023-04-06T07:19:16Z</dc:date>
    <item>
      <title>The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057788#M86871</link>
      <description>&lt;P&gt;I am facing an issue wherein the sum function is returning wrong values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first part is the raw data&lt;/P&gt;
&lt;TABLE width="641"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="105"&gt;Product&lt;/TD&gt;
&lt;TD width="150"&gt;Product Name&lt;/TD&gt;
&lt;TD width="90"&gt;Sub Product&lt;/TD&gt;
&lt;TD width="208"&gt;Sub Product Name&lt;/TD&gt;
&lt;TD width="88"&gt;Collection&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;82&lt;/TD&gt;
&lt;TD&gt;xxx&lt;/TD&gt;
&lt;TD&gt;8163&lt;/TD&gt;
&lt;TD&gt;a&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3,335.64&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;82&lt;/TD&gt;
&lt;TD&gt;xxx&lt;/TD&gt;
&lt;TD&gt;8163&lt;/TD&gt;
&lt;TD&gt;a&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (3,638.08)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;82&lt;/TD&gt;
&lt;TD&gt;xxx&lt;/TD&gt;
&lt;TD&gt;8163&lt;/TD&gt;
&lt;TD&gt;a&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 129,232.60&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;Grand Total&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 128,930.16&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;This is the output for the pivot while using expression&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Product&lt;/TD&gt;
&lt;TD&gt;Sub Product Name&lt;/TD&gt;
&lt;TD&gt;Collection&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;82&lt;/TD&gt;
&lt;TD&gt;8163&lt;/TD&gt;
&lt;TD&gt;258,162.76&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;258,162.76&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dimensions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Product&lt;/P&gt;
&lt;P&gt;Sub Product Name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expression&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sum(collection)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I am doing wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 06:36:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057788#M86871</guid>
      <dc:creator>pashok75</dc:creator>
      <dc:date>2023-04-06T06:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057794#M86872</link>
      <description>&lt;P&gt;I can't say for sure,&amp;nbsp; but I would be looking for duplications in the data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a data table which should show unique data lines and add count() on a id field and confirm it is returning one. If not review the data model.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 06:52:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057794#M86872</guid>
      <dc:creator>Mark_Little</dc:creator>
      <dc:date>2023-04-06T06:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057797#M86873</link>
      <description>&lt;P&gt;Thanks for the response.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can see one record in the straight table and what I observe it is duplicating the value in the sum. But how this happens is confusing. In the data model there is no link to other tables as well. That is what confusing me?&lt;/P&gt;
&lt;P&gt;Ashok&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 06:55:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057797#M86873</guid>
      <dc:creator>pashok75</dc:creator>
      <dc:date>2023-04-06T06:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057800#M86874</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;If I'm right&amp;nbsp; the sum for Product = 82 and Sub Product Name = 8163 must be equal to :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3,335.64 +&amp;nbsp;(3,638.08) +&amp;nbsp;129,232.60 = 136,206.32&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It's not equal to your value in the ligne Grand Total neither to your last lines.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In order to check if, you have some duplications, maybe try this formula : &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Sum(Aggr(sum(distinct collection),Sub Product, Product))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 07:00:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057800#M86874</guid>
      <dc:creator>Sabrina_V</dc:creator>
      <dc:date>2023-04-06T07:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057809#M86875</link>
      <description>&lt;P&gt;I tried this formula now the result is empty. This is my actual column names&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=Sum(Aggr(sum(distinct GNT_QS_PREM),GNT_Class_Code,GNT_SC_Code))&lt;/P&gt;
&lt;P&gt;Formula is showing OK&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But no result set&lt;/P&gt;
&lt;P&gt;Check the screenshot attached.&lt;/P&gt;
&lt;P&gt;1. Expression Formula&lt;/P&gt;
&lt;P&gt;2. Straight Table Data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 07:19:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057809#M86875</guid>
      <dc:creator>pashok75</dc:creator>
      <dc:date>2023-04-06T07:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057812#M86876</link>
      <description>&lt;P&gt;can you try this :&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;=Sum(Aggr(sum(distinct GNT_QS_PREM),GNT_SC_Code,GNT_Class_Code))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Another idea to find some duplicates values :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Straight table with in dimensions :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;GNT_SC_Code&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;GNT_Class_Code&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;GNT_QS_PREM&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;And measure :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;count(GNT_QS_PREM)&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 06 Apr 2023 07:23:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057812#M86876</guid>
      <dc:creator>Sabrina_V</dc:creator>
      <dc:date>2023-04-06T07:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057813#M86877</link>
      <description>&lt;P&gt;Thats a good idea. I will try that to see the duplicates with adding sum as well&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 07:26:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057813#M86877</guid>
      <dc:creator>pashok75</dc:creator>
      <dc:date>2023-04-06T07:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057814#M86878</link>
      <description>&lt;P&gt;I did that and found 2 count. That means qlik is duplicating. How come? there is only one record and what is causing this??&lt;/P&gt;
&lt;P&gt;Ashok&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 07:28:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057814#M86878</guid>
      <dc:creator>pashok75</dc:creator>
      <dc:date>2023-04-06T07:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057828#M86879</link>
      <description>&lt;P&gt;Qlik does not duplicate. You should load on the script only the data for the values you are analyzed and you will see if you load 1 or more lines.&lt;/P&gt;
&lt;P&gt;Do you make some joining on the script ?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 07:53:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057828#M86879</guid>
      <dc:creator>Sabrina_V</dc:creator>
      <dc:date>2023-04-06T07:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057830#M86880</link>
      <description>&lt;P&gt;There is no duplicate in the data. Data is fine. It only has one record. Qlik is duplicating. If I put a pivot in excel it works fine. When I say these are my columns to group why Qlik is considering other columns. I dont understand this?&lt;/P&gt;
&lt;P&gt;Its a straight table and record is one only and there is no join to other table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ashok&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 07:57:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057830#M86880</guid>
      <dc:creator>pashok75</dc:creator>
      <dc:date>2023-04-06T07:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057836#M86881</link>
      <description>&lt;P&gt;Could you just try loading the data with a filter in the script?&lt;/P&gt;
&lt;TABLE width="641"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Product&lt;/TD&gt;
&lt;TD&gt;Sub Product Name&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;82&lt;/TD&gt;
&lt;TD&gt;8163&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An tell me how many lines do you load&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 08:08:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057836#M86881</guid>
      <dc:creator>Sabrina_V</dc:creator>
      <dc:date>2023-04-06T08:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057840#M86882</link>
      <description>&lt;P&gt;HI&lt;/P&gt;
&lt;P&gt;Got the problem. In the Table I see duplicate records creating this confusion. Its the load issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for assistance. Sum should work as intended. Due to data duplicate in load values it is happening. Thank you everyone for your kind support.&lt;/P&gt;
&lt;P&gt;Ashok&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 08:18:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057840#M86882</guid>
      <dc:creator>pashok75</dc:creator>
      <dc:date>2023-04-06T08:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057842#M86883</link>
      <description>&lt;P&gt;Ok great&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Could you indicate your problem as solved ?&lt;/P&gt;
&lt;P&gt;Have a nice day&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 08:21:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057842#M86883</guid>
      <dc:creator>Sabrina_V</dc:creator>
      <dc:date>2023-04-06T08:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: The sum function in aggregation is giving wrong results</title>
      <link>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057855#M86884</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;when you use sum(collection ) &amp;nbsp;then you will get&amp;nbsp;136206.32 value.&lt;/P&gt;
&lt;P&gt;as you have shown your grand total&amp;nbsp;&lt;SPAN&gt;128,930.16&amp;nbsp; , here the value of collection (3,638.08) gets double,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;may be this because of the frequency is double for&amp;nbsp; this&amp;nbsp;&lt;/SPAN&gt;particular data .&lt;/P&gt;
&lt;P&gt;if this is not the case then convert this data into number format&amp;nbsp; by applying&amp;nbsp; below expression:&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;load PurgeChar(Collection,'()') as Collection&amp;nbsp; in script .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;help user find answers ! don't forget to mark&amp;nbsp; a solution that work for you and click the&lt;FONT color="#008000"&gt; like button!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 09:09:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/The-sum-function-in-aggregation-is-giving-wrong-results/m-p/2057855#M86884</guid>
      <dc:creator>Hania</dc:creator>
      <dc:date>2023-04-06T09:09:05Z</dc:date>
    </item>
  </channel>
</rss>

