<?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 Help with Sum function with dataset having duplicate records in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364961#M576607</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to QlikView and am struggling with using sum function with dataset having duplicate records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a dataset which has duplicate records based on a 'bookingid', where it gets split by months 'Jan', 'Feb', 'Mar', etc.. into different records but Quantity field will have the same value, whereas the cost gets split proportinately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to only get the sum of quantity based on a distinct 'bookingid'. For example, refer the below dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BookingID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month&amp;nbsp;&amp;nbsp;&amp;nbsp; Quantity&amp;nbsp;&amp;nbsp; Cost&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; 3100.00&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Feb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; 2900.00&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mar&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; 3100.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to use Sum({&amp;lt;DISTINCT BookingID&amp;gt;} Quantity), QV sums it up as 24, my understanding was by providing the set analysis parameters to only consider DISTINCT BookingID's, the expected result should be 8. Am I doing anything wrong here? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using this in a chart with expression that summarises the Quantity for distinct BookingID's against a few dimensions such as 'Cost Type', 'Vendor', etc..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Much appreciate any help to get this right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Sharad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Apr 2012 03:26:53 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-04-24T03:26:53Z</dc:date>
    <item>
      <title>Help with Sum function with dataset having duplicate records</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364961#M576607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to QlikView and am struggling with using sum function with dataset having duplicate records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a dataset which has duplicate records based on a 'bookingid', where it gets split by months 'Jan', 'Feb', 'Mar', etc.. into different records but Quantity field will have the same value, whereas the cost gets split proportinately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to only get the sum of quantity based on a distinct 'bookingid'. For example, refer the below dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BookingID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month&amp;nbsp;&amp;nbsp;&amp;nbsp; Quantity&amp;nbsp;&amp;nbsp; Cost&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; 3100.00&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Feb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; 2900.00&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mar&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; 3100.00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to use Sum({&amp;lt;DISTINCT BookingID&amp;gt;} Quantity), QV sums it up as 24, my understanding was by providing the set analysis parameters to only consider DISTINCT BookingID's, the expected result should be 8. Am I doing anything wrong here? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using this in a chart with expression that summarises the Quantity for distinct BookingID's against a few dimensions such as 'Cost Type', 'Vendor', etc..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Much appreciate any help to get this right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Sharad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2012 03:26:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364961#M576607</guid>
      <dc:creator />
      <dc:date>2012-04-24T03:26:53Z</dc:date>
    </item>
    <item>
      <title>Help with Sum function with dataset having duplicate records</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364962#M576608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;While there are other ways also to do it. One very simple way is to use Quantity as a dimension rather than Expression because in your scenario it is working as a dimension only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or if you want to put it into expressions then you can simply use avg function also rather then using sum, sum here does not make sense because you don't want to sum the quantities.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, just use &lt;STRONG&gt;avg(Quantity)&lt;/STRONG&gt; then you will see correct data only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;Ashutosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2012 06:31:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364962#M576608</guid>
      <dc:creator />
      <dc:date>2012-04-24T06:31:25Z</dc:date>
    </item>
    <item>
      <title>Help with Sum function with dataset having duplicate records</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364963#M576609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ashutosh, it worked like a breeze, it just takes a while to understand how QV set analysis functions work and you are correct I was using the sum incorrectly in this context!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had multiple sets of such data with various conditional computations on the Quantity required and displayed in &lt;/P&gt;&lt;P&gt;the charts, hence I had used expressions, here is the formula I managed to use to get the average of quantity aggregated by bookingid and did the sum - &lt;STRONG&gt;sum(aggr(avg(Quantity),BookingID))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All my Quantity based computations are working fine now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help!!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2012 07:03:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364963#M576609</guid>
      <dc:creator />
      <dc:date>2012-04-24T07:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Sum function with dataset having duplicate records</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364964#M576610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;Ashutosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Apr 2012 07:10:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Sum-function-with-dataset-having-duplicate-records/m-p/364964#M576610</guid>
      <dc:creator />
      <dc:date>2012-04-24T07:10:33Z</dc:date>
    </item>
  </channel>
</rss>

