<?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: Aggregating in Load Script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239699#M24551</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Nicole.&amp;nbsp; I have thousands of clients and companies to calculate this for.&amp;nbsp; I am pulling the data directly from a qvd.&amp;nbsp; Is there a way to adjust your statement to accommodate that rather than the INLINE portion?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Nov 2016 21:15:46 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-11-18T21:15:46Z</dc:date>
    <item>
      <title>Aggregating in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239697#M24549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have reviewed several other discussions regarding this and haven't come across a solution.&amp;nbsp; I am trying to create a field that will identify how many Employees a Client has in their entire Company and label it as [CompanyEmployees].&amp;nbsp; As a rule of thumb, I can have several Clients within a single Company. My data source is structured as such that we only report on the number of employees at a Client level, not at the Company level.&amp;nbsp; Is it possible to accomplish this within the load script?&amp;nbsp; I would then like to categorize each &lt;STRONG&gt;Client&lt;/STRONG&gt; based on the [CompanyEmployees] number.&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; eg 1-10,11-24, etc.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="244" style="width: 420px; height: 249px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl64" height="46" width="58"&gt;Client &lt;/TD&gt;&lt;TD class="xl64" style="border-left: none;" width="75"&gt;Company&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="106"&gt;# of Employees (Client Level)&lt;/TD&gt;&lt;TD class="xl70" width="119"&gt;&lt;P&gt;&lt;STRONG&gt;# of Employees&lt;/STRONG&gt; (&lt;STRONG&gt;Company Level)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TRYING TO CALC&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl71" style="border-top: none;"&gt;&lt;STRONG&gt;20&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" style="border-top: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl71" style="border-top: none;"&gt;&lt;STRONG&gt;20&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="20" style="border-top: none;"&gt;3&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl72" style="border-top: none;"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="20" style="border-top: none;"&gt;4&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl72" style="border-top: none;"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="20" style="border-top: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl72" style="border-top: none;"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="20" style="border-top: none;"&gt;6&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl72" style="border-top: none;"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="21" style="border-top: none;"&gt;7&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl73" style="border-top: none;"&gt;&lt;STRONG&gt;25&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully this makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As usual, thanks for the help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2016 21:12:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239697#M24549</guid>
      <dc:creator />
      <dc:date>2016-11-11T21:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregating in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239698#M24550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Load Script like this will give you what you have detailed in your original post:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14789010778171019 jive_text_macro" jivemacro_uid="_14789010778171019"&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Client, Company, # of Employees (Client Level)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, 1, 10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 1, 10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, 2, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, 2, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, 2, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6, 2, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7, 2, 5&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LEFT JOIN (Data)&lt;/P&gt;
&lt;P&gt;LOAD Company,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; sum([# of Employees (Client Level)]) AS [# of Employees (Company Level)]&lt;/P&gt;
&lt;P&gt;RESIDENT Data&lt;/P&gt;
&lt;P&gt;GROUP BY Company;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I would suggest keeping the Company Level total in a separate table so that your calculations work appropriately:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14789011199088274 jive_text_macro" jivemacro_uid="_14789011199088274"&gt;
&lt;P&gt;Data:&lt;/P&gt;
&lt;P&gt;LOAD * INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Client, Company, # of Employees (Client Level)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, 1, 10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 1, 10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, 2, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, 2, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, 2, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6, 2, 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7, 2, 5&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Company_Totals:&lt;/P&gt;
&lt;P&gt;LOAD Company,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; sum([# of Employees (Client Level)]) AS [# of Employees (Company Level)]&lt;/P&gt;
&lt;P&gt;RESIDENT Data&lt;/P&gt;
&lt;P&gt;GROUP BY Company;&lt;/P&gt;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doing it like the latter will make sure that if you use any sums in your calculations, you're not summing the 20 twice and the 25 five times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then to classify your numbers into groups, you can use the class function if you want even spaced groups:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/ConditionalFunctions/class.htm" title="http://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/ConditionalFunctions/class.htm"&gt;class ‒ QlikView&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want groups that are unevenly spaced, you will need to write if statements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2016 21:52:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239698#M24550</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2016-11-11T21:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregating in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239699#M24551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Nicole.&amp;nbsp; I have thousands of clients and companies to calculate this for.&amp;nbsp; I am pulling the data directly from a qvd.&amp;nbsp; Is there a way to adjust your statement to accommodate that rather than the INLINE portion?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Nov 2016 21:15:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239699#M24551</guid>
      <dc:creator />
      <dc:date>2016-11-18T21:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregating in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239700#M24552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14797397917524302 jive_text_macro" jivemacro_uid="_14797397917524302"&gt;
&lt;P&gt;Data:&amp;nbsp; &lt;/P&gt;
&lt;P&gt;LOAD [Client],&lt;/P&gt;
&lt;P&gt;&amp;nbsp; [Company],&lt;/P&gt;
&lt;P&gt;&amp;nbsp; [# of Employees (Client Level)]&lt;/P&gt;
&lt;P&gt;FROM YourQVD.qvd (qvd);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Company_Totals:&amp;nbsp; &lt;/P&gt;
&lt;P&gt;LOAD Company,&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; sum([# of Employees (Client Level)]) AS [# of Employees (Company Level)]&amp;nbsp; &lt;/P&gt;
&lt;P&gt;RESIDENT Data&amp;nbsp; &lt;/P&gt;
&lt;P&gt;GROUP BY Company; &lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Nov 2016 14:49:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239700#M24552</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2016-11-21T14:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregating in Load Script</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239701#M24553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nicole,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This accomplished exactly what I was trying to do. Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Todd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2016 19:06:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregating-in-Load-Script/m-p/1239701#M24553</guid>
      <dc:creator />
      <dc:date>2016-11-28T19:06:50Z</dc:date>
    </item>
  </channel>
</rss>

