<?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: Grouping by 3 columns or data issue? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904869#M314552</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;To split sales and return, instead of if condition you could go with filtering it with where clause. By doing this other records gets suppressed instead of holding null value and records will get reduced in the table.&lt;/P&gt;&lt;P&gt;ClassReturnData7:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;&amp;nbsp; //RowNo() as cRowNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp; //RecNo() as cRecNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp; oDC as c1DC,&lt;/P&gt;&lt;P&gt;&amp;nbsp; oOrd_Month as c1Month, &lt;/P&gt;&lt;P&gt;&amp;nbsp; Trim([oPart Number]) as [c1Part#],&lt;/P&gt;&lt;P&gt;&amp;nbsp; (oQuantity)*-1 as c1ClsRtnQty&lt;/P&gt;&lt;P&gt;FROM &lt;C&gt; (qvd)&lt;/C&gt;&lt;/P&gt;&lt;P&gt;Where &lt;SPAN style="font-size: 13.3333330154419px;"&gt;oQuantity&amp;lt;0&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;Store ClassReturnData7 Into &lt;C&gt;;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SalesData7:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;&amp;nbsp; //RowNo() as sRowNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp; //RecNo() as sRecNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp; oDC as s1DC,&lt;/P&gt;&lt;P&gt;&amp;nbsp; oOrd_Month as s1Month, &lt;/P&gt;&lt;P&gt;&amp;nbsp; Trim([oPart Number]) as [s1Part#],&lt;/P&gt;&lt;P&gt;&amp;nbsp; oQuantity as s1SalesQty&lt;/P&gt;&lt;P&gt;FROM &lt;C&gt; (qvd)&lt;/C&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Where &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;oQuantity&amp;gt;0&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Store SalesData7 Into &lt;C&gt;;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next is the Aggr table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ClassReturnsAggr:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;&amp;nbsp; c1DC as cDC,&lt;/P&gt;&lt;P&gt;&amp;nbsp; c1Month as cMonth, &lt;/P&gt;&lt;P&gt;&amp;nbsp; [c1Part#] as cPart#,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; sum(c1ClsRtnQty) as cClsRtnQty// you applied if condition to filter the data but you didn't applied here &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //count(c1Part#) as cCount&lt;/P&gt;&lt;P&gt;FROM &lt;C&gt; (qvd)&lt;/C&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;Where &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;oQuantity&amp;lt;0// apply this where condition, you will get the desired output&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Group by&lt;/P&gt;&lt;P&gt;&amp;nbsp; c1DC,&lt;/P&gt;&lt;P&gt;&amp;nbsp; c1Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp; [c1Part#];&lt;/P&gt;&lt;P&gt;Store ClassReturnsAggr Into &lt;C&gt;;&lt;/C&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Apr 2015 07:53:06 GMT</pubDate>
    <dc:creator>CELAMBARASAN</dc:creator>
    <dc:date>2015-04-26T07:53:06Z</dc:date>
    <item>
      <title>Grouping by 3 columns or data issue?</title>
      <link>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904866#M314549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;I am having an issue that I would normally attribute to a faulty join.&amp;nbsp; But, it’s an aggregation of one table in the load script (I think). The sum of the quantity in the aggregated results table doesn’t match the quantity in ~5% of the records.&amp;nbsp; In some instances, it’s doubled.&amp;nbsp; In others, it’s tripled or more.&amp;nbsp; I can’t recognize a pattern.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;In one instance, there is a part that has two records in the first table.&amp;nbsp; One of the records has a quantity of 10 and the other record’s quantity is null.&amp;nbsp; The second table has one record with a quantity of 30.&amp;nbsp; I added RowNo() and RecNo() to the load of the first table to see what might be hiding.&amp;nbsp; The first table then had seven records, with three of them having a quantity of 10 (the other four are null), equaling 30.&amp;nbsp; As filters, one DC and month is selected.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Why does the 1&lt;SUP&gt;st&lt;/SUP&gt; load only show a total quantity of 10 and two records, then after adding RecNo() and RowNo() – seven records with a total of 30?&amp;nbsp; Why does the aggregation (group by’s) pick them up but they’re not visible without having RecNo() and RowNo()?&amp;nbsp; I’m thinking it’s because the same part may have been received at several of the DC’s during several different months and it causes something to happen that I can’t recognize.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;I have four columns, with three of them that need to be aggregated.&amp;nbsp; The fourth column is quantity.&amp;nbsp; If the quantity is a negative value, I change it to positive.&lt;/SPAN&gt;&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;DC (12 DC’s total)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Month (12 months)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Part # (400K+)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Quantity (-/+)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Here is the load:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;Table1:&lt;BR /&gt;oDC&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;c1DC&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;oOrd_Month&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;c1Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;, &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;Trim&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;[oPart Number]&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;[c1Part#]&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;oQuantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;lt;0,(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;oQuantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)*-1,'') &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;c1ClsRtnQty&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;BR /&gt;Aggregation:&lt;BR /&gt;Table2:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;c1DC&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;cDC&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;c1Month&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;cMonth&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;, &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;[c1Part#]&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;cPart#&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;c1ClsRtnQty&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt;"&gt;cClsRtnQty&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Group by&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;c1DC&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;c1Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;[c1Part#]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;I would post a sample app, but it’s a ton of data (~28mm rows) coming from one text file and I’ve got scattered pieces of sql everywhere.&amp;nbsp; It would be lengthy chore just to get some sample data and recreate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;If anyone can point me in the right direction or tell me what I’m doing wrong, I would greatly appreciate it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Many thanks in advance,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Jason&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Apr 2015 03:42:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904866#M314549</guid>
      <dc:creator>jcampbell474</dc:creator>
      <dc:date>2015-04-25T03:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping by 3 columns or data issue?</title>
      <link>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904867#M314550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jason,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it's hard for me to tell what the problem is just looking at the information provided.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be helpful to see at least the script part with the complete statements, e.g. by posting the relevant part of the qvw script execution log file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should not post any private data and not millions of records, there are some general guidelines around, like&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-1290"&gt;Preparing examples for Upload - Reduction and Data Scrambling&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First thing I noticed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;oQuantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;&amp;lt;0,(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;oQuantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;)*-1,'') &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;c1ClsRtnQty&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;-- in case of a positive oQuantity, shouldn't the value just be used in the else branch then?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;oQuantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;&amp;lt;0,(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;oQuantity&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;)*-1,oQuantity) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: #3d3d3d;"&gt;c1ClsRtnQty&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;or &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;fabs(oQuantity) as c1ClsRtnQty&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;When you are talking about number of records being 2 before applying recno() and 7 after, how have you determined the number of records? When you've created a table box in the UI, please notice that a table box will only show distinct lines, so not showing duplicates.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;In general, trying to shrink down an application to a minimum, still showing the issue, will help you to find the root cause (most of the time yourself, but in any case, it makes it much easier for the forum to help you). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt;"&gt;Stefan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Apr 2015 11:08:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904867#M314550</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-04-25T11:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping by 3 columns or data issue?</title>
      <link>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904868#M314551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Stefan.&amp;nbsp; I think I managed to put a good sample app together that illustrates my issue(s).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In reference to your suggestion that I populate the quantity with a positive value instead of null if it's not a negative number, I can't do that as I need to have only negative numbers in that table.&amp;nbsp; Positive numbers (Sales) in another table.&amp;nbsp; The end result I'm looking for is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(All records have to first be grouped by DC, then Month, then Part.)&lt;/P&gt;&lt;P&gt;1. If quantity is negative, then the entire record is categorized as a return.&amp;nbsp; If it's positive, then it's a sale.&lt;/P&gt;&lt;P&gt;2. For each DC, the sales value had to be subtracted from the return value to arrive at the Carry-Over quantity.&amp;nbsp; E.g., Part 123 has a record with a -5 quantity, and another record with a quantity of 10.&amp;nbsp; The result of 5 means there was no Carry-Over as there were more sales than returns.&amp;nbsp; On the other hand, Part 456 has a record with a quantity of -20, and another record with a quantity of 10.&amp;nbsp; The result of -10 means that there was a quantity of 10 carried over to the next month in that DC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could quite possibly be going about this all wrong - open to any and all suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps and you can point me in the right direction.&amp;nbsp; Again, many thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2015 03:40:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904868#M314551</guid>
      <dc:creator>jcampbell474</dc:creator>
      <dc:date>2015-04-26T03:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping by 3 columns or data issue?</title>
      <link>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904869#M314552</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;To split sales and return, instead of if condition you could go with filtering it with where clause. By doing this other records gets suppressed instead of holding null value and records will get reduced in the table.&lt;/P&gt;&lt;P&gt;ClassReturnData7:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;&amp;nbsp; //RowNo() as cRowNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp; //RecNo() as cRecNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp; oDC as c1DC,&lt;/P&gt;&lt;P&gt;&amp;nbsp; oOrd_Month as c1Month, &lt;/P&gt;&lt;P&gt;&amp;nbsp; Trim([oPart Number]) as [c1Part#],&lt;/P&gt;&lt;P&gt;&amp;nbsp; (oQuantity)*-1 as c1ClsRtnQty&lt;/P&gt;&lt;P&gt;FROM &lt;C&gt; (qvd)&lt;/C&gt;&lt;/P&gt;&lt;P&gt;Where &lt;SPAN style="font-size: 13.3333330154419px;"&gt;oQuantity&amp;lt;0&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;Store ClassReturnData7 Into &lt;C&gt;;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SalesData7:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;&amp;nbsp; //RowNo() as sRowNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp; //RecNo() as sRecNo,&lt;/P&gt;&lt;P&gt;&amp;nbsp; oDC as s1DC,&lt;/P&gt;&lt;P&gt;&amp;nbsp; oOrd_Month as s1Month, &lt;/P&gt;&lt;P&gt;&amp;nbsp; Trim([oPart Number]) as [s1Part#],&lt;/P&gt;&lt;P&gt;&amp;nbsp; oQuantity as s1SalesQty&lt;/P&gt;&lt;P&gt;FROM &lt;C&gt; (qvd)&lt;/C&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Where &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;oQuantity&amp;gt;0&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Store SalesData7 Into &lt;C&gt;;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next is the Aggr table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ClassReturnsAggr:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;&amp;nbsp; c1DC as cDC,&lt;/P&gt;&lt;P&gt;&amp;nbsp; c1Month as cMonth, &lt;/P&gt;&lt;P&gt;&amp;nbsp; [c1Part#] as cPart#,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; sum(c1ClsRtnQty) as cClsRtnQty// you applied if condition to filter the data but you didn't applied here &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //count(c1Part#) as cCount&lt;/P&gt;&lt;P&gt;FROM &lt;C&gt; (qvd)&lt;/C&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;Where &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;oQuantity&amp;lt;0// apply this where condition, you will get the desired output&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Group by&lt;/P&gt;&lt;P&gt;&amp;nbsp; c1DC,&lt;/P&gt;&lt;P&gt;&amp;nbsp; c1Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp; [c1Part#];&lt;/P&gt;&lt;P&gt;Store ClassReturnsAggr Into &lt;C&gt;;&lt;/C&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2015 07:53:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904869#M314552</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2015-04-26T07:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping by 3 columns or data issue?</title>
      <link>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904870#M314553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I edited the script w/the changes you mentioned, but encountered a problem.&amp;nbsp; I might not be understanding it correctly - here are my comments:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #000000;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;sum(c1ClsRtnQty) as cClsRtnQty// you applied if condition to filter the data but you didn't applied here&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 13px; font-family: inherit;"&gt;/ Do I need to apply it here?&amp;nbsp; The If condition is applied in the &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;preceding&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 13px; font-family: inherit;"&gt; load, so would it be effective? /&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #000000;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #000000;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;Where &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;oQuantity&amp;lt;0// apply this where condition, you will get the desired output&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #000000;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;/ The field oQuantity is not present in the table being called.&amp;nbsp; In addition, the quantity field in this column is cClsRtnQty, which was converted to a positive number in the preceding load. /&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;&lt;STRONG style="color: #000000; font-family: inherit; font-size: 13px; font-style: inherit;"&gt; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #000000;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #000000;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;I tried a couple of Where Exists statements with no luck.&amp;nbsp; I also removed all of the filters from the aggregation table and it replicated most records.&amp;nbsp; Do you think I should not convert the negative numbers to positive in the first load, just use them to filter?&amp;nbsp; Then, use them as a filter in the second load and convert to positive there?&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Apr 2015 16:14:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Grouping-by-3-columns-or-data-issue/m-p/904870#M314553</guid>
      <dc:creator>jcampbell474</dc:creator>
      <dc:date>2015-04-26T16:14:27Z</dc:date>
    </item>
  </channel>
</rss>

