<?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: Complex aggr (*I think*) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218541#M854568</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or if you need to omit the Total row;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Aggr(sum({&amp;lt;ClientCode={1},EmployeeCode-={'Total'}&amp;gt;}result),ClientCode)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Feb 2017 14:50:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-02-17T14:50:16Z</dc:date>
    <item>
      <title>Complex aggr (*I think*)</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218538#M854565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't figure this formula out and I am going round in circles so I put myself at your mercy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the following table&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 612px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="98"&gt;ClientCode&lt;/TD&gt;&lt;TD class="xl64" style="border-left: none;" width="98"&gt;EmployeeCode&lt;/TD&gt;&lt;TD class="xl65" width="98"&gt;Employee Visits&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="98"&gt;total client visits&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="98"&gt;total number employees&lt;/TD&gt;&lt;TD class="xl71" width="122"&gt;result&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;a&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-left: none;"&gt;-0.02%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;b&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;8&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0.61%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;c&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;6&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0.24%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;d&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;-0.22%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;e&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;69&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;61.96%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl68" style="border-top: none;"&gt;Total&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;88&lt;/TD&gt;&lt;TD align="right" class="xl69" style="border-top: none; border-left: none;"&gt;88&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="xl70" style="border-top: none; border-left: none;"&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;62.57%&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I Just need to calculate that one figure in the bottom right which is the sum of the percentages above it, note it can be expected that there will be a number of ClientCodes and the result should be calculated for each inidividually&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;End result should be something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="74" style="border: 1px solid #000000; width: 222px; height: 40px;" width="220"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ClientCode&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Result&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;62.57%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12.58%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The formula are quite simple, given the dimensions ClientCode and EmployeeCode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Employee visits = count({&amp;lt;whole bunch of set&amp;gt;} VisitCode)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total Client visits = &lt;SPAN style="font-size: 13.3333px;"&gt;count({&amp;lt;whole bunch of set&amp;gt;} TOTAL &amp;lt;ClientCode&amp;gt; VisitCode)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total Number Employees = &lt;SPAN style="font-size: 13.3333px;"&gt;count({&amp;lt;whole bunch of set&amp;gt;} DISTINCT TOTAL &amp;lt;ClientCode&amp;gt; &lt;SPAN style="font-size: 13.3333px;"&gt;EmployeeCode&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result column is a bit more complex:&lt;/P&gt;&lt;P&gt;=(pow([Employee Visits],2)-([total client visits]/[total number employees]))/(pow([total client visits],2)- [total client visits])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE! It needs to be calculated at the line level and then added up, NOT just the total level, which is the bit that has me foxed!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218538#M854565</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Complex aggr (*I think*)</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218539#M854566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe something like the attached&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:46:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218539#M854566</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-17T14:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Complex aggr (*I think*)</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218540#M854567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I pasted you table into an excel;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Aggr(sum({&amp;lt;ClientCode={1}&amp;gt;}result),ClientCode)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.qvw attached&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:46:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218540#M854567</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-17T14:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Complex aggr (*I think*)</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218541#M854568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or if you need to omit the Total row;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Aggr(sum({&amp;lt;ClientCode={1},EmployeeCode-={'Total'}&amp;gt;}result),ClientCode)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:50:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218541#M854568</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-17T14:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Complex aggr (*I think*)</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218542#M854569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bill,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If I take all the other dimensions our yours doesn't work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The actual answer is (after a momentary flash of inspiration)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(aggr((pow(count(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;VisitCode&lt;/SPAN&gt;),2)-(count(total &amp;lt;ClientCode&amp;gt; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;VisitCode&lt;/SPAN&gt;)/count(DISTINCT TOTAL &amp;lt;ClientCode&amp;gt; EmployeeCode)))/(pow(sum(total &amp;lt;ClientCode&amp;gt; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;VisitCode&lt;/SPAN&gt;),2)-count(total &amp;lt;ClientCode&amp;gt; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;VisitCode&lt;/SPAN&gt;)),ClientCode,EmployeeCode))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:50:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218542#M854569</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2017-02-17T14:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Complex aggr (*I think*)</title>
      <link>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218543#M854570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gareth, unfortunately result is a generated row and not one I have available to me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 14:51:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Complex-aggr-I-think/m-p/1218543#M854570</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2017-02-17T14:51:49Z</dc:date>
    </item>
  </channel>
</rss>

