<?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: Help with aggr expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-aggr-expression/m-p/1204513#M876817</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An aggr() is building a temporary table in memory. Your aggr(total,region) is like a table with a dimension of region and an expression of total. But total has more than one value for region C, for instance, both 2 and 34. So what do you want to see? You haven't told QlikView what to do in this case. Did you want the sum? The average? The minimum? It has no idea. So it will ONLY show you a total where there is only a single value of total for the region. You need to explicitly tell QlikView what you want to do when there are multiple values. I would assume you wanted the sum of the values. That would be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;aggr(sum(total),region)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Though I don't think that will do what you really want. It looks like all you're attempting to build is a plain old table with dimensions of region and country, and the sum of total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Dimension 1 = region&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Dimension 2 = country&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Expression&amp;nbsp; = sum(total)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No aggr() needed for that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Oct 2016 16:27:12 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2016-10-19T16:27:12Z</dc:date>
    <item>
      <title>Help with aggr expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-aggr-expression/m-p/1204512#M876816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am new to QW and so trying out few of the things. I have attached the image of the input file that i have used.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="InputDataSet.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/141076_InputDataSet.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am inserting the above values in straight table. If i write the below expression&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14768142022208999 jive_text_macro" jivemacro_uid="_14768142022208999" modifiedtitle="true"&gt;
&lt;P&gt;=aggr(total,region)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am getting the below result as, i.e. only 2 records.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="WithoutMaxFunctionResult.png" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/141080_WithoutMaxFunctionResult.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;But if i modified the result as&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14768143593197115" jivemacro_uid="_14768143593197115"&gt;
&lt;P&gt;=aggr(total,country)&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is giving me the below result. I have not specified to restrict or not allow any such thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="WithCountry.png" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/141149_WithCountry.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;Can you guys help me understand this behavior of QW. I am using Personal edition of QW.&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/Help-with-aggr-expression/m-p/1204512#M876816</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with aggr expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-aggr-expression/m-p/1204513#M876817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An aggr() is building a temporary table in memory. Your aggr(total,region) is like a table with a dimension of region and an expression of total. But total has more than one value for region C, for instance, both 2 and 34. So what do you want to see? You haven't told QlikView what to do in this case. Did you want the sum? The average? The minimum? It has no idea. So it will ONLY show you a total where there is only a single value of total for the region. You need to explicitly tell QlikView what you want to do when there are multiple values. I would assume you wanted the sum of the values. That would be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;aggr(sum(total),region)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Though I don't think that will do what you really want. It looks like all you're attempting to build is a plain old table with dimensions of region and country, and the sum of total.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Dimension 1 = region&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Dimension 2 = country&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Expression&amp;nbsp; = sum(total)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No aggr() needed for that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 16:27:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-aggr-expression/m-p/1204513#M876817</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-10-19T16:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help with aggr expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-aggr-expression/m-p/1204514#M876818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks John for writing such beautiful reply. &lt;/P&gt;&lt;P&gt;Help me understood AGGR() even better.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 17:37:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-aggr-expression/m-p/1204514#M876818</guid>
      <dc:creator />
      <dc:date>2016-10-19T17:37:52Z</dc:date>
    </item>
  </channel>
</rss>

