<?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: Aggr() creating slightly incorrect results in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308778#M27897</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! Could you explain why this worked?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Apr 2017 15:27:48 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-04-12T15:27:48Z</dc:date>
    <item>
      <title>Aggr() creating slightly incorrect results</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308776#M27895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to count the number of jobs my company runs in a given year. We use the same job number over multiple days (or weeks), so I only want to count each job number the for the first date it was used. I have successfully done this in the data load script, but I am getting slightly incorrect results using the Aggr() function. Here is what I am doing and the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data Load:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ProductionData:&lt;/P&gt;&lt;P&gt;LOAD JobDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year(JobDate) AS JobYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Text(Month(JobDate))&amp;amp;'-'&amp;amp;Text(Year(JobDate)) AS JobMonthYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JobNo;&lt;/P&gt;&lt;P&gt;SQL SELECT JobDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JobNo&lt;/P&gt;&lt;P&gt;FROM prProdControl&lt;/P&gt;&lt;P&gt;WHERE JobDate &amp;gt;= '2010-01-01';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Counter:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Text(Month(MinJobDate))&amp;amp;'-'&amp;amp;Text(Year(MinJobDate)) AS JobMonthYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count(JobNo) AS JobCount&lt;/P&gt;&lt;P&gt;Group By Text(Month(MinJobDate))&amp;amp;'-'&amp;amp;Text(Year(MinJobDate));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Min(JobDate) AS MinJobDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JobNo&lt;/P&gt;&lt;P&gt;Resident ProductionData&lt;/P&gt;&lt;P&gt;Group By JobNo;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="4b1c10920d28483ab28e1e6e6f573a93.png" class="jive-image image-1" height="257" src="https://community.qlik.com/legacyfs/online/159895_4b1c10920d28483ab28e1e6e6f573a93.png" style="height: 257px; width: 773px;" width="773" /&gt;&lt;/P&gt;&lt;P&gt;As you can see, the total counts are the same, but there are small differences. I have verified externally that the Sum(JobCount) results are correct. I have tried everything I can think of and I can't find where these variances are coming from. Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2017 14:46:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308776#M27895</guid>
      <dc:creator />
      <dc:date>2017-04-12T14:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() creating slightly incorrect results</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308777#M27896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(If(Min(TOTAL &amp;lt;JobNo&amp;gt; JobYear) = JobYear, 1, 0), JobNo, JobYear))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:25:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308777#M27896</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-04-12T15:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() creating slightly incorrect results</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308778#M27897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! Could you explain why this worked?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:27:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308778#M27897</guid>
      <dc:creator />
      <dc:date>2017-04-12T15:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr() creating slightly incorrect results</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308779#M27898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why this worked? Difficult to say, but how it worked is I compared the Job Year for each JobNo to there Minimum JobYear. When it matched I assigned it 1, when it did not I assigned it 0. Sum all the 1s to get the count.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2017 15:50:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-creating-slightly-incorrect-results/m-p/1308779#M27898</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-04-12T15:50:04Z</dc:date>
    </item>
  </channel>
</rss>

