<?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 Need help with removing duplicates from a table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314345#M116017</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also use an inner join to get all the columns after getting the max date:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;GUID,&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Date(max(Date),'M/DD/YYYY') as Date&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;resident Table group by GUID;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;inner join load&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;GUID&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Date&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Closed_Date&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;resident Table;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Apr 2012 18:48:55 GMT</pubDate>
    <dc:creator>danielact</dc:creator>
    <dc:date>2012-04-27T18:48:55Z</dc:date>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314338#M116010</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 a table with 2 columns.&amp;nbsp; GUID, Date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GUID, Date&lt;/P&gt;&lt;P&gt;1, 1/30/2012&lt;/P&gt;&lt;P&gt;2, 1/01/2012&lt;/P&gt;&lt;P&gt;3, 1/1/2012&lt;/P&gt;&lt;P&gt;1, 1/31/2012&lt;/P&gt;&lt;P&gt;5, 1/5/2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What's the best to remove the duplicate GUID based on the latest Date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the table above,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to get this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2, 1/01/2012&lt;/P&gt;&lt;P&gt;3, 1/1/2012&lt;/P&gt;&lt;P&gt;1, 1/31/2012&lt;/P&gt;&lt;P&gt;5, 1/5/2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried using the peek function and doing a load ordered by guid desc, date desc, but it still leaves some duplicates and I don't undertand why.&lt;/P&gt;&lt;P&gt;Is there a better way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 18:27:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314338#M116010</guid>
      <dc:creator />
      <dc:date>2012-01-27T18:27:32Z</dc:date>
    </item>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314339#M116011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could do a group by GUID load and finding the latest Date with max(Date):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;GUID,&lt;/P&gt;&lt;P&gt;Date(max(Date),'M/DD/YYYY') as Date&lt;/P&gt;&lt;P&gt;resident Table group by GUID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field Date must be of Date Type with a numerical representation, so that max() function will work on the numerical representation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 19:02:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314339#M116011</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-01-27T19:02:28Z</dc:date>
    </item>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314340#M116012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; HI Stefan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It worked great.&amp;nbsp; However, when I had some additional columns in my table, it gave an invalid expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GUID, Date, Closed_date&lt;/P&gt;&lt;P&gt;1, 1/30/2012, 1/31/2012&lt;/P&gt;&lt;P&gt;2, 1/01/2012, 1/03/2012&lt;/P&gt;&lt;P&gt;3, 1/1/2012, 1/04/2012&lt;/P&gt;&lt;P&gt;1, 1/31/2012, 2/2/2012&lt;/P&gt;&lt;P&gt;5, 1/5/2012, 1/6/2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How come it only works with 2 columns?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 20:55:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314340#M116012</guid>
      <dc:creator />
      <dc:date>2012-01-27T20:55:40Z</dc:date>
    </item>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314341#M116013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to use an aggregation function around each field that you don't list with group by clause but that use in the load statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Or in other, the Help file words:&lt;/P&gt;&lt;P&gt;&lt;A name="kanchor791"&gt;&lt;/A&gt;&lt;A name="group_by"&gt;&lt;/A&gt;&lt;SPAN class="Bold"&gt;group by&lt;/SPAN&gt; is a clause used for defining over which fields the data should be aggregated (grouped). The aggregation fields should be included in some way in the expressions loaded. No other fields than the aggregation fields may be used outside aggregation functions in the loaded expressions. )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you could use something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;LOAD&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;GUID,&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Date(max(Date),'M/DD/YYYY') as Date,&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Date(FirstSortedValue(Closed_date,&amp;nbsp; -Date),'M/DD/YYYY') as Closed_date&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;resident Table group by GUID;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 21:06:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314341#M116013</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-01-27T21:06:21Z</dc:date>
    </item>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314342#M116014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That answered my question.&amp;nbsp; Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jan 2012 19:13:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314342#M116014</guid>
      <dc:creator />
      <dc:date>2012-01-29T19:13:45Z</dc:date>
    </item>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314343#M116015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just realized that my data has duplicate sort-weight which is causing null to be returned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In another words:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GUID, Date, Closed_date&lt;/P&gt;&lt;P&gt;1, 1/30/2012, 1/31/2012&lt;/P&gt;&lt;P&gt;2, 1/01/2012, 1/03/2012&lt;/P&gt;&lt;P&gt;3, 1/1/2012, 1/04/2012&lt;/P&gt;&lt;P&gt;1, 1/31/2012, 2/2/2012&lt;/P&gt;&lt;P&gt;5, 1/5/2012, 1/6/2012&lt;/P&gt;&lt;P&gt;1, 1/30/2012, 1/31/2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when firstsortedvalue (guid, closed_date) for GUID 1 returns NULL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there another way to eliminate duplicates without using firstsortedvalue?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 16:31:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314343#M116015</guid>
      <dc:creator />
      <dc:date>2012-04-27T16:31:52Z</dc:date>
    </item>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314344#M116016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are coping with duplicate rows, you can use a distinct load. &lt;/P&gt;&lt;P&gt;And you can also add distinct keyword to your Firstsortedvalue() function to return the first record if you have duplicate rows with same sort weight (and still get the record with the min/max date for the other records):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt; firstsortedvalue (distinct guid, closed_date) &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 18:23:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314344#M116016</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-04-27T18:23:10Z</dc:date>
    </item>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314345#M116017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also use an inner join to get all the columns after getting the max date:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;GUID,&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Date(max(Date),'M/DD/YYYY') as Date&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;resident Table group by GUID;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;inner join load&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;GUID&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Date&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;Closed_Date&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12px; color: #636363; font-family: Arial;"&gt;resident Table;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 18:48:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314345#M116017</guid>
      <dc:creator>danielact</dc:creator>
      <dc:date>2012-04-27T18:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314346#M116018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems using the previous function worked the way I wanted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if I'm doing anything wrong.&amp;nbsp; I couldn't get peek to work and I couldn't get firstsortedvalue to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 22:46:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314346#M116018</guid>
      <dc:creator />
      <dc:date>2012-04-27T22:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314347#M116019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;firstsortedvalue() with distinct should work (see attached). The editor highlights a syntax error, but this is one of the editor bugs, I think.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 22:56:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314347#M116019</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-04-27T22:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314348#M116020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was confused by the error highlight in the editor and also in the reference manual, "The word distinct before expression or a field is allowed but has no meaning.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 23:09:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314348#M116020</guid>
      <dc:creator />
      <dc:date>2012-04-27T23:09:20Z</dc:date>
    </item>
    <item>
      <title>Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314349#M116021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, editor errors are annoying. And the Help also could be updated at some places.&lt;/P&gt;&lt;P&gt;But in my QV11 version, it says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...If the word &lt;SPAN class="Bold"&gt;distinct&lt;/SPAN&gt; occurs before the &lt;SPAN class="italic;"&gt;expression&lt;/SPAN&gt;, all duplicates will be disregarded. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So here it seems quite helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Apr 2012 23:25:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314349#M116021</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-04-27T23:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with removing duplicates from a table</title>
      <link>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314350#M116022</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.&amp;nbsp; I had to create a new sort table, sort the data first, and then de-dupe the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;new_table2 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?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2012 16:20:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Need-help-with-removing-duplicates-from-a-table/m-p/314350#M116022</guid>
      <dc:creator />
      <dc:date>2012-05-18T16:20:20Z</dc:date>
    </item>
  </channel>
</rss>

