<?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: select top row for each dimension based on max in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451813#M490408</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see attached QVW for sample&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Oct 2012 04:05:46 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-10-01T04:05:46Z</dc:date>
    <item>
      <title>select top row for each dimension based on max</title>
      <link>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451810#M490405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;something you can do in SQL but can Qlikview handle it within a load script or by set analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Given data like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Person&lt;/SPAN&gt;, &lt;SPAN style="text-decoration: underline;"&gt;Type&lt;/SPAN&gt;, &lt;SPAN style="text-decoration: underline;"&gt;Amount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Harris, Green,&amp;nbsp; 35&lt;/P&gt;&lt;P&gt;Harris, Red,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 87.9&lt;/P&gt;&lt;P&gt;Thompson, Yellow,&amp;nbsp; 1004.5&lt;/P&gt;&lt;P&gt;Thompson,Red, 67.8&lt;/P&gt;&lt;P&gt;Stephens, Yellow ,&amp;nbsp;&amp;nbsp; 67.90&lt;/P&gt;&lt;P&gt;Stephens, White,&amp;nbsp; 104.5&lt;/P&gt;&lt;P&gt;Stephens, Blue,&amp;nbsp;&amp;nbsp;&amp;nbsp; 101.89&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You want to return the line for each person with the max(Amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg&amp;nbsp; &lt;/P&gt;&lt;P&gt;Harris, Red,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 87.9&lt;/P&gt;&lt;P&gt;Thompson, Yellow,&amp;nbsp; 1004.5&lt;/P&gt;&lt;P&gt;Stephens, White,&amp;nbsp; 104.5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get the line&amp;nbsp;&amp;nbsp; without the middle type field using a simple Max(amount) expression but how can you get the related type?&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;Message was edited by: pmeacock&#xD;
Thanks.&amp;nbsp; Yes I have tried using rank and I get all the records but in the correct order.&amp;nbsp; How can I then only pick out the records with a rank of 1 or at least sort by the rank column so all the 1s are at the top?&amp;nbsp; I have attached my little test app for reference&#xD;
&#xD;
&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2012 09:29:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451810#M490405</guid>
      <dc:creator />
      <dc:date>2012-09-28T09:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: select top row for each dimension based on max</title>
      <link>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451811#M490406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Within the Script you can do a reload with an ORDER BY Amount DESC and then a Peek() function to extract the first row. You may need to do an intermediate load using a GROUP BY clause first though if you have multiple entries per person.&lt;/P&gt;&lt;P&gt;Within the front end expressions, you can use the Rank(Sum(Amount)) functions. This would be the better way to do it as selections that filter out unwanted persons will be taken into account.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2012 10:32:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451811#M490406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-28T10:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: select top row for each dimension based on max</title>
      <link>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451812#M490407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;You could use (in a chart or in script) firstsortedvalue() function with -Amount as a sort-weight to get the corresponding type. Look at help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2012 15:09:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451812#M490407</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-28T15:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: select top row for each dimension based on max</title>
      <link>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451813#M490408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see attached QVW for sample&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 04:05:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/select-top-row-for-each-dimension-based-on-max/m-p/451813#M490408</guid>
      <dc:creator />
      <dc:date>2012-10-01T04:05:46Z</dc:date>
    </item>
  </channel>
</rss>

