<?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: Sum of Aggregation only for specific IDs in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266883#M517770</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this: sum({&amp;lt;EmployeeID={"=EmployeeID&amp;lt;&amp;gt;SpecialEmployeeID AND Salary&amp;gt;300"}&amp;gt;}Salary)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Dec 2016 08:37:38 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2016-12-15T08:37:38Z</dc:date>
    <item>
      <title>Sum of Aggregation only for specific IDs</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266882#M517769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please help find the answer to the following:&lt;/P&gt;&lt;P&gt;my data is the following:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Department&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;EmployeeID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;SpecialEmployeeID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Salary&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;400&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;500&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create&lt;STRONG&gt; &lt;SPAN style="text-decoration: underline;"&gt;a text object&lt;/SPAN&gt; &lt;/STRONG&gt;with the following: if EmployeeID&amp;lt;&amp;gt;SpecialEmployeeID and Salary of EmployeeID is higher than 300 then sum of their salary&lt;/P&gt;&lt;P&gt;That is what i`ve created, but it doesn`t work &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(if(&lt;/P&gt;&lt;P&gt;&amp;nbsp; aggr( if (EmployeeID&amp;lt;&amp;gt;SpecialEmployeeID , sum(Salary)&amp;nbsp; ,EmployeeID)&amp;gt;300,&lt;/P&gt;&lt;P&gt;aggr( if (EmployeeID&amp;lt;&amp;gt;SpecialEmployeeID , su&lt;SPAN style="font-size: 13.3333px;"&gt;m(&lt;SPAN style="font-size: 13.3333px;"&gt;Salary&lt;/SPAN&gt;)&amp;nbsp; ,&lt;SPAN style="font-size: 13.3333px;"&gt;EmployeeID&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;))&lt;/P&gt;&lt;P&gt;Please, Help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2016 08:32:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266882#M517769</guid>
      <dc:creator />
      <dc:date>2016-12-15T08:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of Aggregation only for specific IDs</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266883#M517770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this: sum({&amp;lt;EmployeeID={"=EmployeeID&amp;lt;&amp;gt;SpecialEmployeeID AND Salary&amp;gt;300"}&amp;gt;}Salary)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2016 08:37:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266883#M517770</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-12-15T08:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of Aggregation only for specific IDs</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266884#M517771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great, it works very well for the following example, thank you very much. The thing is i have another layer of complexity.&lt;/P&gt;&lt;P&gt;I have 2 more columns RsvYear and RsvMonth and AgencyID. Each Employee receive salary for 1 month and year from couple of Agencies. For example - in Nov 2015 Employee number 1 will receive salary from agency 3 and Agency 4. As a result for each month and employee i need sum(salary). Qlikview returns error.&lt;/P&gt;&lt;P&gt;if&amp;nbsp; use your expression I need something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;EmployeeID={"=EmployeeID&amp;lt;&amp;gt;SpecialEmployeeID AND sum(if(RsvMonth=month(today(1))-1 and RsvYear=year(today(1)),Salary))&amp;gt;300"}&amp;gt;}&amp;nbsp; &lt;/P&gt;&lt;P&gt; sum(if(RsvMonth=month(today(1))-1 and RsvYear=year(today(1)),Salary)))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2016 09:32:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266884#M517771</guid>
      <dc:creator />
      <dc:date>2016-12-15T09:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of Aggregation only for specific IDs</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266885#M517772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this your requirement?&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Return sum of salaries for employees without SpecialEmployeeID that in the previous month (by RsvMonth/RsvYear) received salary (in total across all agencies) over 300&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;(I'm asking because I'm not sure if I'm parsing this right...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, the formula would be something like this:&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;EmployeeID&lt;/SPAN&gt;={"&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=EmployeeID&amp;lt;&amp;gt;SpecialEmployeeID AND&lt;/SPAN&gt; sum({&amp;lt;RsvMonth={""=RsvMonth=Month(Today())-1""}, RsvYear={""=RsvMonth=&lt;SPAN style="font-size: 13.3333px;"&gt;Year(Today())&lt;/SPAN&gt;""}&amp;gt;}Salary) &amp;gt; 300"}&amp;gt;})&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ignoring the different agencies is the easy part, because you can use aggregation in search expressions (including in set analysis), the result will be aggregated by the search field (Employee ID in this case). The "previous month" part is more complicated, and notice that what I proposed is a hack job (what happens if it's January?). I'd add a sequential month id in the data (something like Year * 12 + Month), and use it instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2016 14:18:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-of-Aggregation-only-for-specific-IDs/m-p/1266885#M517772</guid>
      <dc:creator>kuba_michalik</dc:creator>
      <dc:date>2016-12-15T14:18:30Z</dc:date>
    </item>
  </channel>
</rss>

