<?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: Avg function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606371#M1096540</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you can try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(Aggr((Sum(Amount)/Count(Distinct UnitDesc)),UnitDesc,YearMonth)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 May 2014 10:53:14 GMT</pubDate>
    <dc:creator>kaushiknsolanki</dc:creator>
    <dc:date>2014-05-07T10:53:14Z</dc:date>
    <item>
      <title>Avg function</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606368#M1096537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just wondering can anyone clarify how this function actually works - to me it seems to calculate correctly sometimes &amp;amp; other times not - see table below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="457"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="17" width="93"&gt;UnitDesc&lt;/TD&gt;&lt;TD class="xl64" width="84"&gt;YearMonth&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="70"&gt;Jan-2013&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="70"&gt;Feb-2013&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="70"&gt;Mar-2013&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="70"&gt;Apr-2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;Apartment 1&lt;/TD&gt;&lt;TD class="xl67"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;Apartment 12&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;Apartment 23&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;450&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,350&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,350&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;Apartment 34&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;641&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" style="border-top: none;"&gt;Apartment 45&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17" style="border-top: none;"&gt;Total&lt;/TD&gt;&lt;TD class="xl70" style="border-top: none;"&gt; &lt;/TD&gt;&lt;TD align="right" class="xl71" style="border-top: none; border-left: none;"&gt;1,300&lt;/TD&gt;&lt;TD align="right" class="xl71" style="border-top: none; border-left: none;"&gt;936&lt;/TD&gt;&lt;TD align="right" class="xl71" style="border-top: none; border-left: none;"&gt;1,310&lt;/TD&gt;&lt;TD align="right" class="xl71" style="border-top: none; border-left: none;"&gt;1,089&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jan &amp;amp; Mar are correct but Feb &amp;amp; Apr aren't - expression is a simple Avg(Amount)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 10:36:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606368#M1096537</guid>
      <dc:creator>anthony_kinsell</dc:creator>
      <dc:date>2014-05-07T10:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Avg function</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606369#M1096538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The difference may be because you might have some records for the month of Feb and Apr where Amount field has null values, so the avg will take the avg of all the records, and may be thus total is not correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try this function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(aggr(avg(Amount),UnitDesc,YearMonth)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 10:40:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606369#M1096538</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2014-05-07T10:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Avg function</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606370#M1096539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had just realised that. I did a less sophisticated formula - but probable has the same result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(Amount) / Count(DISTINCT(UnitDesc))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 10:49:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606370#M1096539</guid>
      <dc:creator>anthony_kinsell</dc:creator>
      <dc:date>2014-05-07T10:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Avg function</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606371#M1096540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you can try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(Aggr((Sum(Amount)/Count(Distinct UnitDesc)),UnitDesc,YearMonth)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 10:53:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606371#M1096540</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2014-05-07T10:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Avg function</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606372#M1096541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Another possible way, make average without nulls with set analysis: Avg({&amp;lt;Amount={'*'}&amp;gt;} Amount)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 11:00:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606372#M1096541</guid>
      <dc:creator />
      <dc:date>2014-05-07T11:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Avg function</title>
      <link>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606373#M1096542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Think my simple formula works best in this case as the problem isn't null values it's numerous values in a given month for a given apartment - for example if an apartment has 4 values in 1 month I want the total of these but divided by 1 not 4. Also if an apartment has no value it should still reduce the overall average.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anthony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 11:05:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avg-function/m-p/606373#M1096542</guid>
      <dc:creator>anthony_kinsell</dc:creator>
      <dc:date>2014-05-07T11:05:38Z</dc:date>
    </item>
  </channel>
</rss>

