<?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: Load only latest record for each unique id in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372784#M830173</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RowNum, PersonID, StartDate, EndDate, CurrentFlag, LocationID&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, 1, 1/1/17, null, 1, Texas&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 1, 4/1/16, 12/31/16, 0, Texas&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, 2, 2/1/17, 4/1/17, 0, Michigan&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, 2, 1/1/17, 1/31/17, 0, Missouri&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, 3, 7/1/17, null, 0, Florida&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6, 3, 1/1/17, 6/30/17, 1, Missouri&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where PersonID &amp;lt;&amp;gt; Previous(PersonID)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By PersonID, CurrentFlag desc, EndDate desc;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jun 2017 18:28:36 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2017-06-28T18:28:36Z</dc:date>
    <item>
      <title>Load only latest record for each unique id</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372781#M830170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to load in historical employee location data (which location they worked at and for how long) but I only want to pull in the most recent record for everyone.&amp;nbsp; Our system flags records as the 'current record' so it's easy to find those, but I want to find records that are no longer current and have a later start date than any other record for that unique ID.&amp;nbsp; When a person resigns, their location data is retained but their most recent record is no longer flagged as current - we want to only look at current records or the last current record for each PersonID.&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;&lt;STRONG&gt;RowNum&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;PersonID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;StartDate&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;EndDate&lt;BR /&gt;&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;CurrentFlag&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;LocationID&lt;/STRONG&gt;&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;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1/1/17&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;null&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Texas&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;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4/1/16&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12/31/16&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Texas&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;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2/1/17&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4/1/17&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Michigan&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;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1/1/17&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1/31/17&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Missouri&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;7/1/17&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;null&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Florida&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1/1/17&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6/30/17&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Missouri&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on this data, we would want to pull rows 1, 3, and 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I better off trying to flag the data in the load using an if statement? I wasn't sure if this was a scenario to use "Group By PersonID".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Phil&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/Load-only-latest-record-for-each-unique-id/m-p/1372781#M830170</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Load only latest record for each unique id</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372782#M830171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So are we saying that if CurrentFlag = 1 for a particular PersonID, then pull the row with CurrentFlag = 1, if it isn't then pull the row where StartDate and EndDate are max?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jun 2017 16:28:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372782#M830171</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-06-28T16:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Load only latest record for each unique id</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372783#M830172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is correct, we want to pull one record for each PersonID given that criteria.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Phil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jun 2017 18:15:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372783#M830172</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-28T18:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Load only latest record for each unique id</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372784#M830173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RowNum, PersonID, StartDate, EndDate, CurrentFlag, LocationID&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1, 1, 1/1/17, null, 1, Texas&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 1, 4/1/16, 12/31/16, 0, Texas&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3, 2, 2/1/17, 4/1/17, 0, Michigan&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4, 2, 1/1/17, 1/31/17, 0, Missouri&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5, 3, 7/1/17, null, 0, Florida&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6, 3, 1/1/17, 6/30/17, 1, Missouri&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where PersonID &amp;lt;&amp;gt; Previous(PersonID)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By PersonID, CurrentFlag desc, EndDate desc;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jun 2017 18:28:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372784#M830173</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-06-28T18:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Load only latest record for each unique id</title>
      <link>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372785#M830174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That seems to have done the trick thank you!&amp;nbsp; I was trying to use max(StartDate) and FirstSortedValue and such with no luck.&amp;nbsp; I'll have to look into Previous() and when to use it in loads.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Sunny!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jun 2017 18:49:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-only-latest-record-for-each-unique-id/m-p/1372785#M830174</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-28T18:49:55Z</dc:date>
    </item>
  </channel>
</rss>

