<?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 Pivot Aggregation - odd results occurring in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Pivot-Aggregation-odd-results-occurring/m-p/650006#M237733</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm doing some aggregateion on a pivot table and was wondering if someone could explain 1 thing that is causing an issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table as below:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 697px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl48" height="32" width="56"&gt;Code1&lt;/TD&gt;&lt;TD class="xl48" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="137"&gt;Code2&lt;/TD&gt;&lt;TD class="xl48" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="141"&gt;AlphaCode&lt;/TD&gt;&lt;TD class="xl49" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="170"&gt;aggregate Count&lt;BR /&gt;&amp;nbsp; of Code 2&lt;/TD&gt;&lt;TD class="xl50" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="112"&gt;aggr(sum(Value), Code2)&lt;/TD&gt;&lt;TD class="xl49" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="81"&gt;Max Value Code 2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl56" height="105" rowspan="5" style="border-top-color: currentColor; border-bottom-color: silver; border-top-width: medium; border-bottom-width: 0.5pt; border-top-style: none; border-bottom-style: solid;" width="56"&gt;9200059&lt;/TD&gt;&lt;TD class="xl54" rowspan="2" style="border-top-color: currentColor; border-bottom-color: silver; border-top-width: medium; border-bottom-width: 0.5pt; border-top-style: none; border-bottom-style: solid;" width="137"&gt;50045705&lt;/TD&gt;&lt;TD class="xl51" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;WPL&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt; &lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl51" height="21" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;SEA&lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt;4&lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;4&lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt;75&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl51" height="21" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="137"&gt;2371172&lt;/TD&gt;&lt;TD class="xl51" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;APQ&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt; &lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;3&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl51" height="21" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="137"&gt;2370752&lt;/TD&gt;&lt;TD class="xl51" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;DEF&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt; &lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;3&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl51" height="21" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="137"&gt;2371811&lt;/TD&gt;&lt;TD class="xl51" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;GHI&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt; &lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;75&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get the max value of sum(value) which I can get and put it in "Max Value Code 2".&amp;nbsp; The issue I have is where it is placed.&amp;nbsp; Why does the 75 not get put on the bottom row alonside the correspondingsum(value) equalling 75?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is causing issues as I want to add more columns stemming from this calculation but it does not work here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expression for the last column is:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aggr(max(aggr(sum(Value), Code2)), Code1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone has ideas or suggestions it would be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brendan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jun 2014 11:17:17 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-06-10T11:17:17Z</dc:date>
    <item>
      <title>Pivot Aggregation - odd results occurring</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Aggregation-odd-results-occurring/m-p/650006#M237733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm doing some aggregateion on a pivot table and was wondering if someone could explain 1 thing that is causing an issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table as below:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 697px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl48" height="32" width="56"&gt;Code1&lt;/TD&gt;&lt;TD class="xl48" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="137"&gt;Code2&lt;/TD&gt;&lt;TD class="xl48" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="141"&gt;AlphaCode&lt;/TD&gt;&lt;TD class="xl49" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="170"&gt;aggregate Count&lt;BR /&gt;&amp;nbsp; of Code 2&lt;/TD&gt;&lt;TD class="xl50" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="112"&gt;aggr(sum(Value), Code2)&lt;/TD&gt;&lt;TD class="xl49" style="border-left-color: currentColor; border-left-width: medium; border-left-style: none;" width="81"&gt;Max Value Code 2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl56" height="105" rowspan="5" style="border-top-color: currentColor; border-bottom-color: silver; border-top-width: medium; border-bottom-width: 0.5pt; border-top-style: none; border-bottom-style: solid;" width="56"&gt;9200059&lt;/TD&gt;&lt;TD class="xl54" rowspan="2" style="border-top-color: currentColor; border-bottom-color: silver; border-top-width: medium; border-bottom-width: 0.5pt; border-top-style: none; border-bottom-style: solid;" width="137"&gt;50045705&lt;/TD&gt;&lt;TD class="xl51" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;WPL&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt; &lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl51" height="21" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;SEA&lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt;4&lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;4&lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt;75&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl51" height="21" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="137"&gt;2371172&lt;/TD&gt;&lt;TD class="xl51" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;APQ&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt; &lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;3&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl51" height="21" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="137"&gt;2370752&lt;/TD&gt;&lt;TD class="xl51" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;DEF&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt; &lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;3&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl51" height="21" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="137"&gt;2371811&lt;/TD&gt;&lt;TD class="xl51" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="141"&gt;GHI&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="170"&gt; &lt;/TD&gt;&lt;TD class="xl52" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="112"&gt;75&lt;/TD&gt;&lt;TD class="xl53" style="border-top-color: currentColor; border-left-color: currentColor; border-top-width: medium; border-left-width: medium; border-top-style: none; border-left-style: none;" width="81"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get the max value of sum(value) which I can get and put it in "Max Value Code 2".&amp;nbsp; The issue I have is where it is placed.&amp;nbsp; Why does the 75 not get put on the bottom row alonside the correspondingsum(value) equalling 75?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is causing issues as I want to add more columns stemming from this calculation but it does not work here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expression for the last column is:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aggr(max(aggr(sum(Value), Code2)), Code1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone has ideas or suggestions it would be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brendan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 11:17:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Aggregation-odd-results-occurring/m-p/650006#M237733</guid>
      <dc:creator />
      <dc:date>2014-06-10T11:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot Aggregation - odd results occurring</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Aggregation-odd-results-occurring/m-p/650007#M237734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To answer your why: Because for all the rows your output is same, and for such cases qv puts the value in the first row unless you have used &lt;STRONG&gt;NoDistinct &lt;/STRONG&gt;keyword in the expression. But using that keyword would not give you what you want, it would populate all the rows with same values. To get your output, you have to put an additional condition to check the equlity of values between previous column and this one.&lt;/P&gt;&lt;P&gt;Somewhat like:&lt;/P&gt;&lt;P&gt;=If(Column(2)= aggr( NoDistinct max(aggr(sum(Value), Code2)), Code1),&amp;nbsp; aggr( NoDistinct max(aggr(sum(Value), Code2)), Code1))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 11:26:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Aggregation-odd-results-occurring/m-p/650007#M237734</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2014-06-10T11:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot Aggregation - odd results occurring</title>
      <link>https://community.qlik.com/t5/QlikView/Pivot-Aggregation-odd-results-occurring/m-p/650008#M237735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That has done the trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Much appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 12:14:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Pivot-Aggregation-odd-results-occurring/m-p/650008#M237735</guid>
      <dc:creator />
      <dc:date>2014-06-10T12:14:04Z</dc:date>
    </item>
  </channel>
</rss>

