<?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: Self Join in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Self-Join/m-p/467583#M1165898</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your data model is probably right as it is. If you try and change it in the script, where do you stop - after 1 year? What about policies that have been renewed 2,3 or 4 times? You'll end up with an endlessly wide table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can achieve what you want with set analysis. Create a straight table chart with your Policy Number as a dimension. Then, as your expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Original Start Date&lt;/P&gt;&lt;P&gt;=Only({&amp;lt;[Current Start Date] = {"&amp;gt;=$(=(Min(Date))&amp;lt;=$(=(Max(Date))"}&amp;gt;} [Current Start Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New Start Date&lt;/P&gt;&lt;P&gt;=Only({&amp;lt;[Current Start Date] = {"&amp;gt;=$(=(AddYears(Min(Date),1))&amp;lt;=$(=(AddYears(Max(Date),1)"}&amp;gt;} [Current Start Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where Date is some kind of calendar table field. &lt;/P&gt;&lt;P&gt;Then do the same with End Dates and your other fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm on the train so haven't tested this and I might have the syntax slightly wrong! Let us know how you get on &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Oct 2012 08:31:37 GMT</pubDate>
    <dc:creator>Jason_Michaelides</dc:creator>
    <dc:date>2012-10-05T08:31:37Z</dc:date>
    <item>
      <title>Self Join</title>
      <link>https://community.qlik.com/t5/QlikView/Self-Join/m-p/467582#M1165897</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'm looking for a way to create a self join within qlikview to take a single sales table and create a self join on Reference number where a policy has been renewed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example if a Sales policy was due to end on the 30/09/2012, but was renewed on the 01/10/2012, I would like to create a table where both records are on 1 line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally I want to create a process where, if the end user selects a date range , the process will look at the policy end dates in that date range, then search for an end date 1 year on to find and new end date based on policy reference number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have enclosed and excel representation of what I am trying to achieve, hope it makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to qlikview, so any help / tips would be most appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 14:52:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Self-Join/m-p/467582#M1165897</guid>
      <dc:creator />
      <dc:date>2012-10-04T14:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Self Join</title>
      <link>https://community.qlik.com/t5/QlikView/Self-Join/m-p/467583#M1165898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your data model is probably right as it is. If you try and change it in the script, where do you stop - after 1 year? What about policies that have been renewed 2,3 or 4 times? You'll end up with an endlessly wide table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can achieve what you want with set analysis. Create a straight table chart with your Policy Number as a dimension. Then, as your expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Original Start Date&lt;/P&gt;&lt;P&gt;=Only({&amp;lt;[Current Start Date] = {"&amp;gt;=$(=(Min(Date))&amp;lt;=$(=(Max(Date))"}&amp;gt;} [Current Start Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New Start Date&lt;/P&gt;&lt;P&gt;=Only({&amp;lt;[Current Start Date] = {"&amp;gt;=$(=(AddYears(Min(Date),1))&amp;lt;=$(=(AddYears(Max(Date),1)"}&amp;gt;} [Current Start Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where Date is some kind of calendar table field. &lt;/P&gt;&lt;P&gt;Then do the same with End Dates and your other fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm on the train so haven't tested this and I might have the syntax slightly wrong! Let us know how you get on &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Oct 2012 08:31:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Self-Join/m-p/467583#M1165898</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2012-10-05T08:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Self Join</title>
      <link>https://community.qlik.com/t5/QlikView/Self-Join/m-p/467584#M1165899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it was me I would keep these as two separate tables linked on the reference number, something like this in the script ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RefNumbers:&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt; [Current ReferenceNumber] AS RefNo,&lt;BR /&gt; [Current Insurer] as Insurer,&lt;BR /&gt; [Current Affiliate ID] as AffiliateID&lt;BR /&gt;resident RawData;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PolicyDates:&lt;BR /&gt;LOAD&lt;BR /&gt; [Current ReferenceNumber] AS RefNo,&lt;BR /&gt; [Current Start Date] as PolicyStartDate, &lt;BR /&gt; [Current End Date] as PolicyEndDate, &lt;BR /&gt; [Current Net Premium] as PolicyNetPremium,&lt;BR /&gt; if([Current Start Date]&amp;lt;=Now() and [Current End Date]&amp;gt;=Now(),'Live',&lt;BR /&gt;&amp;nbsp; if([Current Start Date]&amp;gt;Now(),'Pending',&lt;BR /&gt;&amp;nbsp;&amp;nbsp; 'Expired')) as PolFlag&lt;BR /&gt;resident RawData;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would allow you to build a pivot table with ref no and PolFlag (or status) as dimensions (PloFlag laid out horizontally).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="22988" class="jive-image-thumbnail jive-image" onclick="" alt="example.PNG" src="https://community.qlik.com/legacyfs/online/22988_example.PNG" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Oct 2012 09:26:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Self-Join/m-p/467584#M1165899</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2012-10-05T09:26:08Z</dc:date>
    </item>
  </channel>
</rss>

