<?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 sorting then removing duplicates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sorting-then-removing-duplicates/m-p/1232182#M392541</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When loading the data I need to keep only the latest record.&lt;/P&gt;&lt;P&gt;I don't have a date to rely on to determine the latest record but I have a status, based on which I can sort in a somewhat chronological order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read that Order By can only be used on Resident Loads and that removing duplicates was achieved by joining the data with itself.&lt;/P&gt;&lt;P&gt;The sorting by Status works fine.&lt;/P&gt;&lt;P&gt;but it seems I can't join a resident load with itself&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Raw]:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp; [STATUS],&lt;/P&gt;&lt;P&gt; If([STATUS]='Canceled', '1',&amp;nbsp; If([STATUS]='Closed', '2', If([&lt;SPAN style="font-size: 13.3333px;"&gt;STATUS&lt;/SPAN&gt;]='Transmited', '3',))) as 'Status ID',&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt; FROM [....]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Ordered]:&lt;/P&gt;&lt;P&gt;Load&amp;nbsp; *&lt;/P&gt;&lt;P&gt;Resident [Raw] Order By [&lt;SPAN style="font-size: 13.3333px;"&gt;Status ID&lt;/SPAN&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join ([&lt;SPAN style="font-size: 13.3333px;"&gt;Ordered&lt;/SPAN&gt;])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Unique]&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;Resident [&lt;SPAN style="font-size: 13.3333px;"&gt;Ordered&lt;/SPAN&gt;] &lt;/P&gt;&lt;P&gt;Group By [&lt;SPAN style="font-size: 13.3333px;"&gt;Status&lt;/SPAN&gt; ID];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Feb 2017 21:54:54 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-02-20T21:54:54Z</dc:date>
    <item>
      <title>sorting then removing duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-then-removing-duplicates/m-p/1232182#M392541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When loading the data I need to keep only the latest record.&lt;/P&gt;&lt;P&gt;I don't have a date to rely on to determine the latest record but I have a status, based on which I can sort in a somewhat chronological order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read that Order By can only be used on Resident Loads and that removing duplicates was achieved by joining the data with itself.&lt;/P&gt;&lt;P&gt;The sorting by Status works fine.&lt;/P&gt;&lt;P&gt;but it seems I can't join a resident load with itself&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Raw]:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp; [STATUS],&lt;/P&gt;&lt;P&gt; If([STATUS]='Canceled', '1',&amp;nbsp; If([STATUS]='Closed', '2', If([&lt;SPAN style="font-size: 13.3333px;"&gt;STATUS&lt;/SPAN&gt;]='Transmited', '3',))) as 'Status ID',&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt; FROM [....]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Ordered]:&lt;/P&gt;&lt;P&gt;Load&amp;nbsp; *&lt;/P&gt;&lt;P&gt;Resident [Raw] Order By [&lt;SPAN style="font-size: 13.3333px;"&gt;Status ID&lt;/SPAN&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join ([&lt;SPAN style="font-size: 13.3333px;"&gt;Ordered&lt;/SPAN&gt;])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Unique]&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;Resident [&lt;SPAN style="font-size: 13.3333px;"&gt;Ordered&lt;/SPAN&gt;] &lt;/P&gt;&lt;P&gt;Group By [&lt;SPAN style="font-size: 13.3333px;"&gt;Status&lt;/SPAN&gt; ID];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2017 21:54:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-then-removing-duplicates/m-p/1232182#M392541</guid>
      <dc:creator />
      <dc:date>2017-02-20T21:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: sorting then removing duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-then-removing-duplicates/m-p/1232183#M392542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume you have an ID field that identifies each "thing" (case, order whatever) that you want to keep. Maybe you are looking for something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Raw:&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;&amp;nbsp; Match(Status,'Cancelled','Closed','Transmitted')&amp;nbsp; as StatusID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;INLINE [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ID, Status, Foo&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, Cancelled, A1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1, Closed, A2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;2, Transmitted, Z1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;3, Closed, Y1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;3, Transmitted, Y2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;]&lt;/SPAN&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;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;INNER JOIN (Raw)&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;&amp;nbsp; ID,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; min(StatusID) as StatusID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Resident Raw&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Group by ID&lt;/SPAN&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://masterssummit.com" rel="nofollow" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com" rel="nofollow" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Feb 2017 22:40:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-then-removing-duplicates/m-p/1232183#M392542</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2017-02-20T22:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: sorting then removing duplicates</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-then-removing-duplicates/m-p/1232184#M392543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="EN-CA" style="color: #575757; font-family: Arial; font-size: 10pt;"&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;T&lt;/SPAN&gt;hanks Rob!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-CA" style="color: #575757; font-family: Arial; font-size: 10pt;"&gt; I like the min(StatusID) trick, pretty easier than my sorting then filtering...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-CA" style="color: #575757; font-family: Arial; font-size: 10pt;"&gt;I like the use of match() to associate numbers/id to strings too. In my case I actually need a default case but because match() returns 0 when no match is found it still works fine,&amp;nbsp; I just reverted the order of the various statuses, and used max() instead of min().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-CA" style="color: #575757; font-family: Arial; font-size: 10pt;"&gt;Great tricks, thanks for your help &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2017 17:14:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-then-removing-duplicates/m-p/1232184#M392543</guid>
      <dc:creator />
      <dc:date>2017-02-21T17:14:31Z</dc:date>
    </item>
  </channel>
</rss>

