<?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>article The sortable Aggr function in Qlik Sense in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/The-sortable-Aggr-function-in-Qlik-Sense/ta-p/1717515</link>
    <description>&lt;P&gt;The&amp;nbsp;Aggr&amp;nbsp;function is used for advanced aggregations, in which the&amp;nbsp;Aggr function is enclosed in another aggregation function, using the array of results from the&amp;nbsp;Aggr&amp;nbsp;function as input to the aggregation in which it is nested. Aggr() returns an array of values for the expression calculated over the stated dimension or dimensions. But the question is if there is way of influencing the order in which the dimension or dimensions are taken into account by the Aggr function.&lt;/P&gt;
&lt;P&gt;We see &amp;nbsp;better what I mean with an example:&lt;/P&gt;
&lt;P&gt;Let load the following script code to a Qlik Sense app.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;load * inline [
Field_1, Field_2, 
1,2
1,3
2,15
2,7];&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If we now in the front end put the following expression&lt;FONT face="courier new,courier"&gt;=only(aggr(above(Sum(Field_2)), Field_1))&lt;/FONT&gt;on a text box object, the result will be 5, since the Aggr function will take into account first the value 1 and sen the value 2, but &amp;nbsp;is there any way that the Aggr function takes into account first the value 2 and then the value 1, so the result will be 22 instead.&lt;/P&gt;
&lt;P&gt;The Aggr function has been modified in QlikSense comapred to QlikView 11. The syntax of the function in Qlik Sense is:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Aggr({SetExpression}[DISTINCT] [NODISTINCT&amp;nbsp;] expr, StructuredParameter{, StructuredParameter}).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;For a detailed explanation of each parameter, please visit &lt;A href="https://help.qlik.com/" target="_blank" rel="noopener"&gt;help.qlik.com&lt;/A&gt;.&lt;/P&gt;
&lt;P class="qlik-migrated-tkb-headings"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3 class="qlik-migrated-tkb-headings"&gt;Resolution:&lt;/H3&gt;
&lt;P&gt;&lt;BR /&gt;The solution is to use the parameter&amp;nbsp;StructuredParameter for the Aggr function. If you use this parameter and modify the expression in the text object &amp;nbsp;to &lt;FONT face="courier new,courier"&gt;=only(aggr(above(Sum(Field_2)), (Field_1,(Numeric, DESCENDING))))&amp;nbsp;&lt;/FONT&gt;then you get the desired result.&lt;/P&gt;</description>
    <pubDate>Tue, 10 May 2022 19:23:50 GMT</pubDate>
    <dc:creator>Sonja_Bauernfeind</dc:creator>
    <dc:date>2022-05-10T19:23:50Z</dc:date>
    <item>
      <title>The sortable Aggr function in Qlik Sense</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/The-sortable-Aggr-function-in-Qlik-Sense/ta-p/1717515</link>
      <description>&lt;P&gt;The&amp;nbsp;Aggr&amp;nbsp;function is used for advanced aggregations, in which the&amp;nbsp;Aggr function is enclosed in another aggregation function, using the array of results from the&amp;nbsp;Aggr&amp;nbsp;function as input to the aggregation in which it is nested. Aggr() returns an array of values for the expression calculated over the stated dimension or dimensions. But the question is if there is way of influencing the order in which the dimension or dimensions are taken into account by the Aggr function.&lt;/P&gt;
&lt;P&gt;We see &amp;nbsp;better what I mean with an example:&lt;/P&gt;
&lt;P&gt;Let load the following script code to a Qlik Sense app.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;load * inline [
Field_1, Field_2, 
1,2
1,3
2,15
2,7];&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If we now in the front end put the following expression&lt;FONT face="courier new,courier"&gt;=only(aggr(above(Sum(Field_2)), Field_1))&lt;/FONT&gt;on a text box object, the result will be 5, since the Aggr function will take into account first the value 1 and sen the value 2, but &amp;nbsp;is there any way that the Aggr function takes into account first the value 2 and then the value 1, so the result will be 22 instead.&lt;/P&gt;
&lt;P&gt;The Aggr function has been modified in QlikSense comapred to QlikView 11. The syntax of the function in Qlik Sense is:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Aggr({SetExpression}[DISTINCT] [NODISTINCT&amp;nbsp;] expr, StructuredParameter{, StructuredParameter}).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;For a detailed explanation of each parameter, please visit &lt;A href="https://help.qlik.com/" target="_blank" rel="noopener"&gt;help.qlik.com&lt;/A&gt;.&lt;/P&gt;
&lt;P class="qlik-migrated-tkb-headings"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3 class="qlik-migrated-tkb-headings"&gt;Resolution:&lt;/H3&gt;
&lt;P&gt;&lt;BR /&gt;The solution is to use the parameter&amp;nbsp;StructuredParameter for the Aggr function. If you use this parameter and modify the expression in the text object &amp;nbsp;to &lt;FONT face="courier new,courier"&gt;=only(aggr(above(Sum(Field_2)), (Field_1,(Numeric, DESCENDING))))&amp;nbsp;&lt;/FONT&gt;then you get the desired result.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 19:23:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/The-sortable-Aggr-function-in-Qlik-Sense/ta-p/1717515</guid>
      <dc:creator>Sonja_Bauernfeind</dc:creator>
      <dc:date>2022-05-10T19:23:50Z</dc:date>
    </item>
  </channel>
</rss>

