<?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 Getting second lowest value from Aggr doesn't work correctly in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Getting-second-lowest-value-from-Aggr-doesn-t-work-correctly/m-p/272808#M497770</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to get the second lowest price for each product and the solution was clear in my mind so no problems there. What happened however was that the aggregation table for some reason seems to create one extra minimum row, or then the min() function doesn't work as it should.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expression is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;=min(TOTAL &amp;lt;Product&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aggr(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(Spend)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(QTY)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Product, Company&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;, 2&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does not give the second lowest price but instead the lowest price, ie. the same result comes if I change the parameter 2 to 1. If I change the parameter to 3, I get the second lowest price.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the resulting table showing the minimum price with different parameters:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="6497" alt="min_aggr_problem.png" class="jive-image-thumbnail jive-image" src="https://community.qlik.com/legacyfs/online/6497_min_aggr_problem.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, parameters 1 and 2 return the lowest price and 3 the second lowest. Why is the function doing this, have I done something wrong or do I miss some important thing here? Of course the quick and dirty solution is to use parameter 3 instead of 2, but since I don't have a clue what is going on I can't do that. I couldn't be sure it would always work as it should even though it seems that way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas what causes this or is this a known problem? I'm using QV10.00.8935.7 SR2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: I've included an example file if that makes it easier to see the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Henry Backman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Aug 2011 13:44:56 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-08-15T13:44:56Z</dc:date>
    <item>
      <title>Getting second lowest value from Aggr doesn't work correctly</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-second-lowest-value-from-Aggr-doesn-t-work-correctly/m-p/272808#M497770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to get the second lowest price for each product and the solution was clear in my mind so no problems there. What happened however was that the aggregation table for some reason seems to create one extra minimum row, or then the min() function doesn't work as it should.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expression is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;=min(TOTAL &amp;lt;Product&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aggr(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(Spend)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(QTY)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , Product, Company&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;, 2&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does not give the second lowest price but instead the lowest price, ie. the same result comes if I change the parameter 2 to 1. If I change the parameter to 3, I get the second lowest price.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the resulting table showing the minimum price with different parameters:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="6497" alt="min_aggr_problem.png" class="jive-image-thumbnail jive-image" src="https://community.qlik.com/legacyfs/online/6497_min_aggr_problem.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, parameters 1 and 2 return the lowest price and 3 the second lowest. Why is the function doing this, have I done something wrong or do I miss some important thing here? Of course the quick and dirty solution is to use parameter 3 instead of 2, but since I don't have a clue what is going on I can't do that. I couldn't be sure it would always work as it should even though it seems that way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas what causes this or is this a known problem? I'm using QV10.00.8935.7 SR2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: I've included an example file if that makes it easier to see the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Henry Backman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Aug 2011 13:44:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-second-lowest-value-from-Aggr-doesn-t-work-correctly/m-p/272808#M497770</guid>
      <dc:creator />
      <dc:date>2011-08-15T13:44:56Z</dc:date>
    </item>
    <item>
      <title>Getting second lowest value from Aggr doesn't work correctly</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-second-lowest-value-from-Aggr-doesn-t-work-correctly/m-p/272809#M497771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a bug in QlikView software and will be fixed at some point. Only workaround is to use the parameter n+1 to get the rank n.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Oct 2011 06:16:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-second-lowest-value-from-Aggr-doesn-t-work-correctly/m-p/272809#M497771</guid>
      <dc:creator />
      <dc:date>2011-10-27T06:16:51Z</dc:date>
    </item>
  </channel>
</rss>

