<?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: Loading rows with max value in a field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loading-rows-with-max-value-in-a-field/m-p/1055978#M640652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your filter contained a further field ArtID which probably caused that you get several max. values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Feb 2016 19:28:48 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2016-02-17T19:28:48Z</dc:date>
    <item>
      <title>Loading rows with max value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-rows-with-max-value-in-a-field/m-p/1055977#M640651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to do is the follwing:&lt;/P&gt;&lt;P&gt;I have a folder with qvds which are named like 09-xyz.qvd or 12-xyz.qvd&lt;/P&gt;&lt;P&gt;The number at the beginning is always the hour of the export, so the greater the number the later the export.&lt;/P&gt;&lt;P&gt;With the script below I load them all and concatenate them to one table. I need them all in one table for another calculation.&lt;/P&gt;&lt;P&gt;After the calculation in another table I want to filter the initial table test so that I only have the rows from the latest file which is the max of _Hour.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried it with the inner keep load to just keep the rows with max(_Hour) as you can see. Tried it with a small self-written data sample which worked fine. Afterwards I tried it with this for-loop and the resulting big test table (2.7 Mio rows) and without the calculation between. The filter works somehow as it just keeps 346k rows but it still has 9 and 12h rows. Am I doing any mistake here? Shouldn't it just keep the rows with 12 as _Hour because its the max?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help guys!&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Seb&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14557309823897100" jivemacro_uid="_14557309823897100"&gt;
&lt;P&gt;Set vPath = C:\Test;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;For each File in FileList('$(vPath)\*.qvd')&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;test:&lt;/P&gt;
&lt;P&gt;Load&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ArtID,&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; num(Left(FileBaseName(),2)) as _Hour&lt;/P&gt;
&lt;P&gt;From $(File)&lt;/P&gt;
&lt;P&gt;(qvd);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;filter:&lt;/P&gt;
&lt;P&gt;inner keep load&lt;/P&gt;
&lt;P&gt;ArtID,&lt;/P&gt;
&lt;P&gt;Max(_Hour) as _Hour&lt;/P&gt;
&lt;P&gt;resident test&lt;/P&gt;
&lt;P&gt;group by ArticleNumber;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;drop table filter;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 17:56:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-rows-with-max-value-in-a-field/m-p/1055977#M640651</guid>
      <dc:creator />
      <dc:date>2016-02-17T17:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Loading rows with max value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-rows-with-max-value-in-a-field/m-p/1055978#M640652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your filter contained a further field ArtID which probably caused that you get several max. values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 19:28:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-rows-with-max-value-in-a-field/m-p/1055978#M640652</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-02-17T19:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Loading rows with max value in a field</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-rows-with-max-value-in-a-field/m-p/1055979#M640653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you want to filter by max of ArtID&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="font-style: inherit; font-weight: inherit; line-height: 1.5em; color: #006699; font-size: 9pt !important;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword" style="font-style: inherit; font-weight: inherit; line-height: 1.5em; color: #006699; font-size: 9pt !important;"&gt;&lt;EM&gt;inner&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN style="color: black; font-weight: inherit; line-height: 1.5em; font-size: 9pt !important;"&gt; keep &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; line-height: 1.5em; color: #006699; font-size: 9pt !important;"&gt;load&lt;/SPAN&gt;&lt;SPAN style="color: black; font-weight: inherit; line-height: 1.5em; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="line-height: 1.5em; color: black; font-size: 9pt; font-weight: inherit;"&gt;ArtID,&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: black; font-size: 9pt !important; background-color: inherit; font-weight: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-size: 9pt !important; background-color: inherit;"&gt;(_Hour) &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-size: 9pt !important; background-color: inherit;"&gt; _Hour&amp;nbsp; &lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: black; font-size: 9pt !important; background-color: inherit; font-weight: inherit;"&gt;resident test&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: black; font-size: 9pt !important; background-color: inherit; font-weight: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;group&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-size: 9pt !important; background-color: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; color: #006699; font-size: 9pt !important; background-color: inherit;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-size: 9pt !important; background-color: inherit;"&gt; ArtID;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN style="color: black; font-family: arial, helvetica, sans-serif; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: arial, helvetica, sans-serif; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: arial, helvetica, sans-serif; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: arial, helvetica, sans-serif; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;if you only want the max of all records&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: arial, helvetica, sans-serif; font-size: 9pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN class="keyword" style="font-style: inherit; font-weight: inherit; color: #006699; font-size: 9pt !important;"&gt;&lt;EM&gt;inner&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN style="color: black; font-weight: inherit; font-size: 9pt !important;"&gt; keep &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; color: #006699; font-size: 9pt !important;"&gt;load&lt;/SPAN&gt;&lt;SPAN style="color: black; font-weight: inherit; font-size: 9pt !important;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;EM style="color: black; font-size: 9pt !important; font-weight: inherit;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; color: #006699; font-size: 9pt !important;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-size: 9pt !important;"&gt;(_Hour) &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; color: #006699; font-size: 9pt !important;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-size: 9pt !important;"&gt; _Hour&amp;nbsp; &lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;EM&gt;&lt;SPAN style="font-weight: inherit; color: black; font-size: 9pt !important;"&gt;resident test &lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; color: black; font-size: 9pt !important; font-weight: inherit;"&gt;;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN style="line-height: 1.5em; color: black; font-size: 9pt; font-style: inherit; font-weight: inherit;"&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 19:58:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-rows-with-max-value-in-a-field/m-p/1055979#M640653</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2016-02-17T19:58:27Z</dc:date>
    </item>
  </channel>
</rss>

