<?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: problem with using previous and order by resident table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/problem-with-using-previous-and-order-by-resident-table/m-p/332251#M122407</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A simple way to retain only the first row of a key field(s) is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Data:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD *&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE AutoNumber(recno(), guid) = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Load * Inline [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;guid, create_date, close_date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, 1/1/2012, 1/2/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2, 1/2/2012, 2/3/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, 1/1/2012, 1/2/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, 1/1/2012, 4/2/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://robwunderlich.com"&gt;http://robwunderlich.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 May 2012 22:25:43 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2012-05-31T22:25:43Z</dc:date>
    <item>
      <title>problem with using previous and order by resident table</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-using-previous-and-order-by-resident-table/m-p/332249#M122405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just discovered something interesting.&amp;nbsp; Please see attached file for reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I tried to do a order by in the same table as I am doing the previous, it breaks (new_table1).&amp;nbsp; I had to create a new sort table, sort the data first, and then de-dupe the data (new_table4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;new_table1 shows that it doesn't work while new_table4 does work after I do a sort_table first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, since I have to do 2 table loads using the previous function, which will be faster?&amp;nbsp; Using distinct or use the 2 tables and the previous function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 19:46:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-using-previous-and-order-by-resident-table/m-p/332249#M122405</guid>
      <dc:creator />
      <dc:date>2012-05-31T19:46:27Z</dc:date>
    </item>
    <item>
      <title>problem with using previous and order by resident table</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-using-previous-and-order-by-resident-table/m-p/332250#M122406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like a lot of trouble just to ensure that the rows are DISTINCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. You can add the keyword DISTINCT after the LOAD to get to the same result. Keep in mind, however, that the DISTINCT applies to all the fields in the row - i.e. if some of the non-key fields are different, the rows will be technically considered DISTINCT even though they key is the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. To ensure that the keys are unique, I'd rather load the same info using GROUP BY and min() or firstsortedvalue() for all non-key fields:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;Key1, Key2, Key3,&lt;/P&gt;&lt;P&gt;min(Attr1) as Attr1,&lt;/P&gt;&lt;P&gt; MinString(Attr2) as Attr2,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;resident&lt;/P&gt;&lt;P&gt;Table1&lt;/P&gt;&lt;P&gt;group by&lt;/P&gt;&lt;P&gt;Key1, Key2, Key3&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 21:47:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-using-previous-and-order-by-resident-table/m-p/332250#M122406</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2012-05-31T21:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: problem with using previous and order by resident table</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-using-previous-and-order-by-resident-table/m-p/332251#M122407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A simple way to retain only the first row of a key field(s) is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Data:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD *&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;WHERE AutoNumber(recno(), guid) = 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Load * Inline [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;guid, create_date, close_date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, 1/1/2012, 1/2/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2, 1/2/2012, 2/3/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, 1/1/2012, 1/2/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, 1/1/2012, 4/2/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://robwunderlich.com"&gt;http://robwunderlich.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2012 22:25:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-using-previous-and-order-by-resident-table/m-p/332251#M122407</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2012-05-31T22:25:43Z</dc:date>
    </item>
  </channel>
</rss>

