<?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: Assign Latest ID To Duplicate Records in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443650#M819244</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this in front end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=aggr(max(PersonID),Email)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Aug 2017 09:34:37 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-08-22T09:34:37Z</dc:date>
    <item>
      <title>Assign Latest ID To Duplicate Records</title>
      <link>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443647#M819238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QV12 SR4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am being supplied with a table (directly from SQL Server) like the following which essentially contains duplicated people hence the differing PersonIDs but same email address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;PersonID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Email&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;EventID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;CompanyName&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com" target="_blank"&gt;me@you.com&lt;/A&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;123&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Company1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com" target="_blank"&gt;me@you.com&lt;/A&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;321&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Company2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com" target="_blank"&gt;me@you.com&lt;/A&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;456&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Company3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com" target="_blank"&gt;me@you.com&lt;/A&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;654&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Company4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use the latest PersonID for each record so would end up with something like this which i can break down to extract EventIDs etc at a later stage:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;PersonID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Email&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;EventID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;CompanyName&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com" target="_blank"&gt;me@you.com&lt;/A&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;123&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Company1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com" target="_blank"&gt;me@you.com&lt;/A&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;321&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Company2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com" target="_blank"&gt;me@you.com&lt;/A&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;456&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Company3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com" target="_blank"&gt;me@you.com&lt;/A&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;654&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Company4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking i could possibly use PEEK if i order the table correctly but have not had to do something quite like this before and perhaps i am missing a better way to achieve this.&amp;nbsp; Meanwhile i'll have a play with PEEK and see what happens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443647#M819238</guid>
      <dc:creator>haymarketpaul</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Latest ID To Duplicate Records</title>
      <link>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443648#M819239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this in backend&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load *Inline [&lt;/P&gt;&lt;P&gt;PersonID, Email, EventID, CompanyName&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1, &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com"&gt;me@you.com&lt;/A&gt;&lt;SPAN&gt;, 123, Company1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2, &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com"&gt;me@you.com&lt;/A&gt;&lt;SPAN&gt;, 321, Company2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3, &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com"&gt;me@you.com&lt;/A&gt;&lt;SPAN&gt;, 456, Company3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4, &lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:me@you.com"&gt;me@you.com&lt;/A&gt;&lt;SPAN&gt;, 654, Company4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;left Join&lt;/P&gt;&lt;P&gt;load Email,&lt;/P&gt;&lt;P&gt;max(PersonID) as Psnid &lt;/P&gt;&lt;P&gt;Resident Table group by Email; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2017 09:31:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443648#M819239</guid>
      <dc:creator />
      <dc:date>2017-08-22T09:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Latest ID To Duplicate Records</title>
      <link>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443649#M819241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Peek might work, if you order your data set in Email, PersonID descending order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively you could use applymap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MaxPersonIDMap:&lt;/P&gt;&lt;P&gt;MAPPING LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Email,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; max(PersonID) as maxPersonID&lt;/P&gt;&lt;P&gt;FROM [Your data source]&lt;/P&gt;&lt;P&gt;GROUP BY Email;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then simply use&lt;/P&gt;&lt;P&gt;ApplyMap('MaxPersonIDMap', Email, '[Unknown]') as PersonID&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2017 09:33:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443649#M819241</guid>
      <dc:creator>marcus_malinow</dc:creator>
      <dc:date>2017-08-22T09:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Latest ID To Duplicate Records</title>
      <link>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443650#M819244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this in front end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=aggr(max(PersonID),Email)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2017 09:34:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443650#M819244</guid>
      <dc:creator />
      <dc:date>2017-08-22T09:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Latest ID To Duplicate Records</title>
      <link>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443651#M819246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Paul&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try below script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;abc:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id, name, company&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, a, cc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, a, cf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, a, cg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, b, cgg&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maxidtable:&lt;/P&gt;&lt;P&gt;load max(id) as maxid&lt;/P&gt;&lt;P&gt;Resident abc;&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;LET vLatest=peek('maxid',0,'maxidtable');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;$(vLatest) as ID,&lt;/P&gt;&lt;P&gt;name,&lt;/P&gt;&lt;P&gt;company&lt;/P&gt;&lt;P&gt;Resident abc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table abc,maxidtable;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2017 09:39:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443651#M819246</guid>
      <dc:creator>omkarvamsi</dc:creator>
      <dc:date>2017-08-22T09:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Latest ID To Duplicate Records</title>
      <link>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443652#M819248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for replies all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thirumal - backend solution works nicely - good to know&lt;/P&gt;&lt;P&gt;Marcus - went with ApplyMap as the correct answer as a little bit cleaner as i don't have to Left Join any additional fields&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2017 10:13:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assign-Latest-ID-To-Duplicate-Records/m-p/1443652#M819248</guid>
      <dc:creator>haymarketpaul</dc:creator>
      <dc:date>2017-08-22T10:13:09Z</dc:date>
    </item>
  </channel>
</rss>

