<?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 Isolate highest two values from a field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Isolate-highest-two-values-from-a-field/m-p/156037#M32073</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I'm looking for a way to isolate the two highest values from a certain field, based on selections, and without using Set Analysis (Client is running 8.2). For example - if user selects 2009 Q2, 2009 Q1, 2008 Q4, 2008 Q3 - I need to isolate the values '2009 Q2' and '2009 Q1' (which may not be the last two values in the load order for this selection.&lt;/P&gt;&lt;P&gt;Since I may be going about the entire problem the wrong way - what I'm trying to do is create a table that looks like this:&lt;/P&gt;&lt;P&gt;Data (in reality, the data is not aggregated, each item/quarter will have multiple rows of data):&lt;/P&gt;&lt;P&gt;&lt;B&gt;Item&lt;/B&gt; - ABCD &lt;B&gt;Quarter&lt;/B&gt; - 2009 Q2 &lt;B&gt;Sales&lt;/B&gt; - 12500&lt;/P&gt;&lt;P&gt;&lt;B&gt;Item&lt;/B&gt; - ABCD &lt;B&gt;Quarter&lt;/B&gt; - 2009 Q1 &lt;B&gt;Sales&lt;/B&gt; - 5000&lt;/P&gt;&lt;P&gt;&lt;B&gt;Item&lt;/B&gt; - ABCD &lt;B&gt;Quarter&lt;/B&gt; - 2008 Q4 &lt;B&gt;Sales&lt;/B&gt; - 15000&lt;/P&gt;&lt;P&gt;&lt;B&gt;Item&lt;/B&gt; - ABCD &lt;B&gt;Quarter&lt;/B&gt; - 2008 Q3 &lt;B&gt;Sales&lt;/B&gt; - 7500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;ITEM - AVERAGE SALES PER QUARTER - SALES LAST SELECTED QUARTER - SALES PREV. SELECTED QUARTER&lt;/P&gt;&lt;P&gt;ABCD - 10000 - 12500 - 5000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas on how to get this done efficiently (and ideally, without significant script modifications) would be appreciated. Keep in mind I can't pre-aggregate the values because I need them to change based on other selections (e.g. Customer, region, etc)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Aug 2009 20:44:37 GMT</pubDate>
    <dc:creator>Or</dc:creator>
    <dc:date>2009-08-12T20:44:37Z</dc:date>
    <item>
      <title>Isolate highest two values from a field</title>
      <link>https://community.qlik.com/t5/QlikView/Isolate-highest-two-values-from-a-field/m-p/156037#M32073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I'm looking for a way to isolate the two highest values from a certain field, based on selections, and without using Set Analysis (Client is running 8.2). For example - if user selects 2009 Q2, 2009 Q1, 2008 Q4, 2008 Q3 - I need to isolate the values '2009 Q2' and '2009 Q1' (which may not be the last two values in the load order for this selection.&lt;/P&gt;&lt;P&gt;Since I may be going about the entire problem the wrong way - what I'm trying to do is create a table that looks like this:&lt;/P&gt;&lt;P&gt;Data (in reality, the data is not aggregated, each item/quarter will have multiple rows of data):&lt;/P&gt;&lt;P&gt;&lt;B&gt;Item&lt;/B&gt; - ABCD &lt;B&gt;Quarter&lt;/B&gt; - 2009 Q2 &lt;B&gt;Sales&lt;/B&gt; - 12500&lt;/P&gt;&lt;P&gt;&lt;B&gt;Item&lt;/B&gt; - ABCD &lt;B&gt;Quarter&lt;/B&gt; - 2009 Q1 &lt;B&gt;Sales&lt;/B&gt; - 5000&lt;/P&gt;&lt;P&gt;&lt;B&gt;Item&lt;/B&gt; - ABCD &lt;B&gt;Quarter&lt;/B&gt; - 2008 Q4 &lt;B&gt;Sales&lt;/B&gt; - 15000&lt;/P&gt;&lt;P&gt;&lt;B&gt;Item&lt;/B&gt; - ABCD &lt;B&gt;Quarter&lt;/B&gt; - 2008 Q3 &lt;B&gt;Sales&lt;/B&gt; - 7500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;ITEM - AVERAGE SALES PER QUARTER - SALES LAST SELECTED QUARTER - SALES PREV. SELECTED QUARTER&lt;/P&gt;&lt;P&gt;ABCD - 10000 - 12500 - 5000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas on how to get this done efficiently (and ideally, without significant script modifications) would be appreciated. Keep in mind I can't pre-aggregate the values because I need them to change based on other selections (e.g. Customer, region, etc)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Aug 2009 20:44:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Isolate-highest-two-values-from-a-field/m-p/156037#M32073</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2009-08-12T20:44:37Z</dc:date>
    </item>
    <item>
      <title>Isolate highest two values from a field</title>
      <link>https://community.qlik.com/t5/QlikView/Isolate-highest-two-values-from-a-field/m-p/156038#M32074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's one way:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum(if(Quarter=max(total Quarter), Sales))&lt;BR /&gt;sum(if(Quarter=max(total Quarter,2), Sales))&lt;/P&gt;&lt;P&gt;See attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2009 04:00:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Isolate-highest-two-values-from-a-field/m-p/156038#M32074</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-08-13T04:00:55Z</dc:date>
    </item>
  </channel>
</rss>

