<?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 Retrieve Max Date at Grouped Level - Group By? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168837#M39853</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hope someone can assist:&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;I'm looking at a table called 'Policy' that lists Policy numbers and renewal dates - ie one policy number can have multiple renewal dates within the table eg:&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;Policy Renewal&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;A 01/01/2008&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;B 01/02/2009&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;A 01/01/2009&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;B 01/02/2009&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;A 01/01/2010&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;C 01/03/2010&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;So what I need to do is a resident load perhaps that will return 1 row per Policy and the maximum Renewal date for that Policy - ie the most recent so I can link that back to Policy for use within the front end. I've tried using a Resident Load and Group By:&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="font-style: italic"&gt;ReportDate:&lt;/P&gt;&lt;P&gt;&lt;B&gt;Load&lt;/B&gt; Policy.ParentPolicyId &lt;B&gt;as&lt;/B&gt; RPParentPolicyID,&lt;/P&gt;&lt;P&gt;max(Policy.EndDate) &lt;B&gt;as&lt;/B&gt; ReportDate&lt;/P&gt;&lt;P&gt;&lt;B&gt;Resident&lt;/B&gt; Policy &lt;B&gt;Group&lt;/B&gt; &lt;B&gt;By&lt;/B&gt; RPParentPolicyID;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;But that isn't working as the script falls over.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P&gt;I can return the relevant date in a table grouped at the Policy Level in the front end but that isn't suitable unfortunately.&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Mar 2010 15:16:30 GMT</pubDate>
    <dc:creator>matt_crowther</dc:creator>
    <dc:date>2010-03-04T15:16:30Z</dc:date>
    <item>
      <title>Retrieve Max Date at Grouped Level - Group By?</title>
      <link>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168837#M39853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hope someone can assist:&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;I'm looking at a table called 'Policy' that lists Policy numbers and renewal dates - ie one policy number can have multiple renewal dates within the table eg:&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;Policy Renewal&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;A 01/01/2008&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;B 01/02/2009&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;A 01/01/2009&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;B 01/02/2009&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;A 01/01/2010&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;C 01/03/2010&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;So what I need to do is a resident load perhaps that will return 1 row per Policy and the maximum Renewal date for that Policy - ie the most recent so I can link that back to Policy for use within the front end. I've tried using a Resident Load and Group By:&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="font-style: italic"&gt;ReportDate:&lt;/P&gt;&lt;P&gt;&lt;B&gt;Load&lt;/B&gt; Policy.ParentPolicyId &lt;B&gt;as&lt;/B&gt; RPParentPolicyID,&lt;/P&gt;&lt;P&gt;max(Policy.EndDate) &lt;B&gt;as&lt;/B&gt; ReportDate&lt;/P&gt;&lt;P&gt;&lt;B&gt;Resident&lt;/B&gt; Policy &lt;B&gt;Group&lt;/B&gt; &lt;B&gt;By&lt;/B&gt; RPParentPolicyID;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;But that isn't working as the script falls over.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P&gt;I can return the relevant date in a table grouped at the Policy Level in the front end but that isn't suitable unfortunately.&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Mar 2010 15:16:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168837#M39853</guid>
      <dc:creator>matt_crowther</dc:creator>
      <dc:date>2010-03-04T15:16:30Z</dc:date>
    </item>
    <item>
      <title>Retrieve Max Date at Grouped Level - Group By?</title>
      <link>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168838#M39854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Matt&lt;/P&gt;&lt;P&gt;you shoud use the original field name for grouping:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;STRONG&gt;Group&lt;/STRONG&gt; &lt;B&gt;By&lt;/B&gt; Policy.ParentPolicyId; &lt;B&gt;&lt;/B&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Good luck,&lt;/P&gt;&lt;P&gt;Justinas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Mar 2010 15:26:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168838#M39854</guid>
      <dc:creator>justinasp</dc:creator>
      <dc:date>2010-03-04T15:26:51Z</dc:date>
    </item>
    <item>
      <title>Retrieve Max Date at Grouped Level - Group By?</title>
      <link>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168839#M39855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;you ware using the new name "RPParentPolicyID" that you gave to the field "Policy.ParentPolicyId"&lt;/P&gt;&lt;P&gt;as the field for your GROUP BY clause&lt;/P&gt;&lt;P&gt;the new name will only be known after the load statement finishes so the load itself still knows the field by its old name (Policy.ParentPolicyId)&lt;/P&gt;&lt;P&gt;change your code to this:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;// right join&lt;/P&gt;&lt;P&gt;//id suggest unmarking the above join to make sure only records with the MAX(DATE) stayes at the end.&lt;BR /&gt;&lt;/P&gt;&lt;P style="font-style: italic; margin: 0cm 0cm 0pt"&gt;ReportDate:&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;B&gt;Load&lt;/B&gt; Policy.ParentPolicyId &lt;B&gt;as&lt;/B&gt; RPParentPolicyID,&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;max(Policy.EndDate) &lt;B&gt;as&lt;/B&gt; ReportDate&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;B&gt;Resident&lt;/B&gt; Policy &lt;B&gt;Group&lt;/B&gt; &lt;B&gt;By&lt;/B&gt; Policy.ParentPolicyId;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;this should work&lt;/P&gt;&lt;P&gt;Mansyno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Mar 2010 15:31:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168839#M39855</guid>
      <dc:creator>wizardo</dc:creator>
      <dc:date>2010-03-04T15:31:29Z</dc:date>
    </item>
    <item>
      <title>Retrieve Max Date at Grouped Level - Group By?</title>
      <link>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168840#M39856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello. Look at this example. Maybe it will halp you.&lt;/P&gt;&lt;P&gt;Table1:&lt;BR /&gt;load * inline&lt;BR /&gt;[Policy, Renewal&lt;BR /&gt;A,01/01/2008&lt;BR /&gt;B,01/02/2009&lt;BR /&gt;A,01/01/2009&lt;BR /&gt;B,01/02/2009&lt;BR /&gt;A,01/01/2010&lt;BR /&gt;C,01/03/2010];&lt;BR /&gt;&lt;BR /&gt;Table2:&lt;BR /&gt;load distinct&lt;BR /&gt;Policy&lt;BR /&gt;resident Table1;&lt;BR /&gt;&lt;BR /&gt;left join (Table2) load&lt;BR /&gt;Policy,&lt;BR /&gt;max(Renewal) as Renewal&lt;BR /&gt;resident Table1&lt;BR /&gt;group by Policy;&lt;BR /&gt;&lt;BR /&gt;drop table Table1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Mar 2010 15:37:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168840#M39856</guid>
      <dc:creator />
      <dc:date>2010-03-04T15:37:40Z</dc:date>
    </item>
    <item>
      <title>Retrieve Max Date at Grouped Level - Group By?</title>
      <link>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168841#M39857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello. Look at this example. Maybe it will halp you.&lt;/P&gt;&lt;P&gt;Table1:&lt;BR /&gt;load * inline&lt;BR /&gt;[Policy, Renewal&lt;BR /&gt;A,01/01/2008&lt;BR /&gt;B,01/02/2009&lt;BR /&gt;A,01/01/2009&lt;BR /&gt;B,01/02/2009&lt;BR /&gt;A,01/01/2010&lt;BR /&gt;C,01/03/2010];&lt;BR /&gt;&lt;BR /&gt;Table2:&lt;BR /&gt;load distinct&lt;BR /&gt;Policy&lt;BR /&gt;resident Table1;&lt;BR /&gt;&lt;BR /&gt;left join (Table2) load&lt;BR /&gt;Policy,&lt;BR /&gt;max(Renewal) as Renewal&lt;BR /&gt;resident Table1&lt;BR /&gt;group by Policy;&lt;BR /&gt;&lt;BR /&gt;drop table Table1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Mar 2010 15:37:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Retrieve-Max-Date-at-Grouped-Level-Group-By/m-p/168841#M39857</guid>
      <dc:creator />
      <dc:date>2010-03-04T15:37:48Z</dc:date>
    </item>
  </channel>
</rss>

