<?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 Top 3 x for each y in load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484333#M689892</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 have to pull out the top 3 x's for each y based on a frequency field during the load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My data is in the following format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X&lt;/P&gt;&lt;P&gt;Y&lt;/P&gt;&lt;P&gt;Frequency_field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been playing around with recno() but can't get it to restart for each X... Does anyone have any elegant solutions to this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Sep 2013 15:10:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-09-26T15:10:14Z</dc:date>
    <item>
      <title>Top 3 x for each y in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484333#M689892</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 have to pull out the top 3 x's for each y based on a frequency field during the load script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My data is in the following format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X&lt;/P&gt;&lt;P&gt;Y&lt;/P&gt;&lt;P&gt;Frequency_field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been playing around with recno() but can't get it to restart for each X... Does anyone have any elegant solutions to this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 15:10:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484333#M689892</guid>
      <dc:creator />
      <dc:date>2013-09-26T15:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Top 3 x for each y in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484334#M689893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you need the numbers?&amp;nbsp; What about a loop for all Y, and in each loop use "first 3", and order by Frequency_field desc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 15:39:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484334#M689893</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-26T15:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Top 3 x for each y in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484335#M689894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gareth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the below something that you are looking for? It ranks every Project based on exclusivity. So you can use set analysis to get the top N Projects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Rank={"&amp;lt;=3"}&amp;gt;} Bid)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fact:&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;,RecNo() as ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create ID Field&lt;/P&gt;&lt;P&gt;INLINE [&lt;/P&gt;&lt;P&gt;Customer, Project, Exclusive, Bid&lt;/P&gt;&lt;P&gt;A, foo, 1, 40&lt;/P&gt;&lt;P&gt;B, foo, 0, 1&lt;/P&gt;&lt;P&gt;C, foo, 0, 2&lt;/P&gt;&lt;P&gt;D, foo, 0, 4&lt;/P&gt;&lt;P&gt;E, foo, 0, 7&lt;/P&gt;&lt;P&gt;F, foo, 0, 10&lt;/P&gt;&lt;P&gt;A, bar, 0, 10&lt;/P&gt;&lt;P&gt;B, bar, 0, 4&lt;/P&gt;&lt;P&gt;A, ded, 1, 30&lt;/P&gt;&lt;P&gt;B, ded, 1, 15&lt;/P&gt;&lt;P&gt;C, ded, 0, 5&lt;/P&gt;&lt;P&gt;D, ded, 0, 5&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Join Rank to Fact table&lt;/P&gt;&lt;P&gt;LEFT JOIN (Fact)&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;,if(Project=Previous(Project),peek(Rank)+1,1) as Rank&lt;/P&gt;&lt;P&gt;RESIDENT Fact&lt;/P&gt;&lt;P&gt;ORDER BY Exclusive,Project, Bid DESC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/46973_Capture.PNG.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2013 05:20:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484335#M689894</guid>
      <dc:creator>manas_bn</dc:creator>
      <dc:date>2013-09-27T05:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Top 3 x for each y in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484336#M689895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #008000;"&gt;*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;INLINE&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #008000;"&gt;[ &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;EM style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/EM&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;Rank&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #008000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080; font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 8pt;"&gt;Previous&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;Y&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &amp;lt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;Y&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 8pt;"&gt;Peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;'Rank'&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) + &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;AS&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #008000;"&gt;Rank&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;RESIDENT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #008000;"&gt;Temp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ORDER&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;By&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;Y&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 8pt;"&gt;X&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; color: #008000;"&gt;Desc;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;DROP&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG style="color: #0000ff; font-size: 8pt;"&gt;TABLE&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Temp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Regards,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Jagan.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2013 05:36:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484336#M689895</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2013-09-27T05:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Top 3 x for each y in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484337#M689896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant!&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have never seen the peek and previous functions used in that way in a load - very clever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GPC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2013 09:23:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Top-3-x-for-each-y-in-load-script/m-p/484337#M689896</guid>
      <dc:creator />
      <dc:date>2013-09-27T09:23:18Z</dc:date>
    </item>
  </channel>
</rss>

