<?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: Average is not working. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092089#M918998</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pavana the syntax isn't right. Avg(Sum(...)) will never work. You need to add Aggr() between them... with some dimensions over which you are doing the inner aggregation which is ultimately used for Avg(). But without more details, it would be difficult to say more. Can you may be provide a sample with expected output?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;Avg(Aggr(&lt;/STRONG&gt;&lt;STRONG style="line-height: 1.5em;"&gt;RangeAvg(Sum({$&amp;lt;[Lease Type]-={'Our Subtenant'}&amp;gt;}[Rentable Area (sq ft)]), -&lt;/STRONG&gt;&lt;STRONG style="line-height: 1.5em;"&gt;Sum({$&amp;lt;[Lease Type] ={'Our Subtenant'}&amp;gt;}[Rentable Area (sq ft)])), &lt;/STRONG&gt;&lt;SPAN style="color: #ff0000;"&gt;SomeDimension/sHere&lt;/SPAN&gt;&lt;STRONG style="line-height: 1.5em;"&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Tried to simplify your expression a little bit. You just need to add Dimension or Dimensions on which you want to do the inner aggregation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 May 2016 18:31:11 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-05-06T18:31:11Z</dc:date>
    <item>
      <title>Average is not working.</title>
      <link>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092088#M918997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the below expression..but it is not working...how can I make thi s work&lt;/P&gt;&lt;P&gt;avg(((Sum({$&amp;lt;[Lease Type]-={'Our Subtenant'}&amp;gt;}[Rentable Area (sq ft)])) +&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Sum({$&amp;lt;[Lease Type]={'Our Subtenant'}&amp;gt;}[Rentable Area (sq ft)])* -1)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks much.&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/Average-is-not-working/m-p/1092088#M918997</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Average is not working.</title>
      <link>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092089#M918998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pavana the syntax isn't right. Avg(Sum(...)) will never work. You need to add Aggr() between them... with some dimensions over which you are doing the inner aggregation which is ultimately used for Avg(). But without more details, it would be difficult to say more. Can you may be provide a sample with expected output?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;Avg(Aggr(&lt;/STRONG&gt;&lt;STRONG style="line-height: 1.5em;"&gt;RangeAvg(Sum({$&amp;lt;[Lease Type]-={'Our Subtenant'}&amp;gt;}[Rentable Area (sq ft)]), -&lt;/STRONG&gt;&lt;STRONG style="line-height: 1.5em;"&gt;Sum({$&amp;lt;[Lease Type] ={'Our Subtenant'}&amp;gt;}[Rentable Area (sq ft)])), &lt;/STRONG&gt;&lt;SPAN style="color: #ff0000;"&gt;SomeDimension/sHere&lt;/SPAN&gt;&lt;STRONG style="line-height: 1.5em;"&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Tried to simplify your expression a little bit. You just need to add Dimension or Dimensions on which you want to do the inner aggregation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 18:31:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092089#M918998</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-06T18:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Average is not working.</title>
      <link>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092090#M918999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is what my data looks like and I am converting Rentable area to negative value where Lease type is subtenant and then I need the avg for the Rentable area.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/123781_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 18:50:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092090#M918999</guid>
      <dc:creator />
      <dc:date>2016-05-06T18:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Average is not working.</title>
      <link>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092091#M919000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Avg(Aggr(&lt;/STRONG&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;RangeAvg(Sum({$&amp;lt;[Lease Type]-={'Our Subtenant'}&amp;gt;}[Rentable Area (sq ft)]), -&lt;/STRONG&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum({$&amp;lt;[Lease Type] ={'Our Subtenant'}&amp;gt;}[Rentable Area (sq ft)])), &lt;/STRONG&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #ff0000;"&gt;&lt;STRONG&gt;building&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 18:56:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092091#M919000</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-06T18:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Average is not working.</title>
      <link>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092092#M919001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could also create a flag in your script, like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; building,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Rentable Area (sq ft)],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Lease Type],&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If([Lease Type] = 'Our Subtenant',-1,1) as factor&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FROM ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then your aggregation would boil down to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Sum( [Rentable Area (sq ft)] *factor)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And for the average I would use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;=Sum( [Rentable Area (sq ft)] *factor) / Count(DISTINCT building)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 20:00:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Average-is-not-working/m-p/1092092#M919001</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-05-06T20:00:33Z</dc:date>
    </item>
  </channel>
</rss>

