<?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 aggr function with condition in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157105#M32716</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two tables, they look like this (there are more columnes but I only show the intresting one here):&lt;/P&gt;&lt;P&gt;table1&lt;BR /&gt;Key agent team status&lt;BR /&gt;1 Kalle teamA oncall&lt;BR /&gt;1 Kalle teamA wrapup&lt;BR /&gt;2 Pelle teamA oncall&lt;BR /&gt;2 Kalle teamA oncall&lt;BR /&gt;2 Kalle teamA wrapup&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table2&lt;BR /&gt;Key destination calls_ans calls_ans_req&lt;BR /&gt;1 Kalle 1 0&lt;BR /&gt;2 Pelle 1 0&lt;BR /&gt;2 Kalle 0 1&lt;/P&gt;&lt;P&gt;This means that for call with Key=1 it is Kalle who has answered the call. For call with Key=2 it is Pelle who has answered the call and then he requeued the call and the next time it is Kalle who has answered the call.&lt;/P&gt;&lt;P&gt;What I was trying to do was to calculate how many calls each agent has taken. Thats why I tried with condition destination=agent but I don't get it to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Aug 2010 09:20:24 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-08-12T09:20:24Z</dc:date>
    <item>
      <title>aggr function with condition</title>
      <link>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157103#M32714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;I have a problem with aggr function when I have a condition in the function.&lt;/P&gt;&lt;P&gt;First I wrote like this:&lt;BR /&gt;sum(aggr(&lt;BR /&gt; sum(calls_ans)&lt;BR /&gt; ,team,agent))&lt;/P&gt;&lt;P&gt;but it was not right, I need a condition so I wrote like this:&lt;BR /&gt;sum(aggr(&lt;BR /&gt; sum(if (agent=destination,calls_ans,0))&lt;BR /&gt; ,team,agent))&lt;/P&gt;&lt;P&gt;This give me to large sum. It seems to be a problem to have a condition for "agent" when one of the dimension also are "agent".&lt;/P&gt;&lt;P&gt;Please help me understand how aggr works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Aug 2010 17:26:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157103#M32714</guid>
      <dc:creator />
      <dc:date>2010-08-11T17:26:21Z</dc:date>
    </item>
    <item>
      <title>aggr function with condition</title>
      <link>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157104#M32715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aggr() works just like a straight table. So this should give you a result as if you had a table with dimensions team and agent, expression sum(if(agent=destination,calls_ans,0)), and a total row that was sum of rows. If you actually build that straight table, perhaps it will help show what's going on.&lt;/P&gt;&lt;P&gt;One thing that looks suspicious to me is the use of "destination". Is that a field? If it's a field, and more than one destination is selected, I'd expect the sum to return 0. But you say you have a large sum, so I suppose that's not it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Aug 2010 21:48:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157104#M32715</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-08-11T21:48:30Z</dc:date>
    </item>
    <item>
      <title>aggr function with condition</title>
      <link>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157105#M32716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two tables, they look like this (there are more columnes but I only show the intresting one here):&lt;/P&gt;&lt;P&gt;table1&lt;BR /&gt;Key agent team status&lt;BR /&gt;1 Kalle teamA oncall&lt;BR /&gt;1 Kalle teamA wrapup&lt;BR /&gt;2 Pelle teamA oncall&lt;BR /&gt;2 Kalle teamA oncall&lt;BR /&gt;2 Kalle teamA wrapup&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table2&lt;BR /&gt;Key destination calls_ans calls_ans_req&lt;BR /&gt;1 Kalle 1 0&lt;BR /&gt;2 Pelle 1 0&lt;BR /&gt;2 Kalle 0 1&lt;/P&gt;&lt;P&gt;This means that for call with Key=1 it is Kalle who has answered the call. For call with Key=2 it is Pelle who has answered the call and then he requeued the call and the next time it is Kalle who has answered the call.&lt;/P&gt;&lt;P&gt;What I was trying to do was to calculate how many calls each agent has taken. Thats why I tried with condition destination=agent but I don't get it to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Aug 2010 09:20:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157105#M32716</guid>
      <dc:creator />
      <dc:date>2010-08-12T09:20:24Z</dc:date>
    </item>
    <item>
      <title>aggr function with condition</title>
      <link>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157106#M32717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps what you need to do is create a common key field between the two tables. This is done by having a field with the same name in each table. In your case, "agent" would be the key. Use &lt;B&gt;destination as agent&lt;/B&gt; in the load statement for table 2.&lt;/P&gt;&lt;P&gt;If you need destination as a field because it is used elsewhere, then you can also say something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;LOAD Key,&lt;BR /&gt; destination,&lt;BR /&gt; destination AS agent,&lt;BR /&gt;...&lt;BR /&gt;FROM .....&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Then your first aggr expression should work.&lt;/P&gt;&lt;P&gt;Or else just create a chart/table with dimension &lt;B&gt;agent&lt;/B&gt; (or &lt;B&gt;destination&lt;/B&gt; if you decide noot to follow the first suggestion) and expression &lt;B&gt;sum(call_ans)&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Hope these help &lt;IMG alt="Cool" src="http://community.qlik.com/emoticons/emotion-11.gif" /&gt;&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Aug 2010 10:09:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/aggr-function-with-condition/m-p/157106#M32717</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2010-08-12T10:09:42Z</dc:date>
    </item>
  </channel>
</rss>

