<?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 How to use startdate-1 as prev enddate? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670001#M1071722</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a tabel with income estimates over time by PersonID. Each income-estimate has&amp;nbsp; registerdate,&amp;nbsp; startdate, enddate and estimate-ID (uniq per registration). The problem are that the registrator can registrate new income-estimates without ending the previous. Registrations without a enddate gets date(today()). And that my problem, I need to close the prev registrations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The registration has a specific ID in desc order so I´m hopeful someone here can help me how to set enddates were there are a new registration. I Think it should be possible to use the new startdate - 1 as enddate for the prev registrationId by each PersonID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached are a sample data with some Persons that have multiple, open registrations. And two that are correct registrated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Aug 2014 12:03:58 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-08-28T12:03:58Z</dc:date>
    <item>
      <title>How to use startdate-1 as prev enddate?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670001#M1071722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have a tabel with income estimates over time by PersonID. Each income-estimate has&amp;nbsp; registerdate,&amp;nbsp; startdate, enddate and estimate-ID (uniq per registration). The problem are that the registrator can registrate new income-estimates without ending the previous. Registrations without a enddate gets date(today()). And that my problem, I need to close the prev registrations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The registration has a specific ID in desc order so I´m hopeful someone here can help me how to set enddates were there are a new registration. I Think it should be possible to use the new startdate - 1 as enddate for the prev registrationId by each PersonID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached are a sample data with some Persons that have multiple, open registrations. And two that are correct registrated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 12:03:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670001#M1071722</guid>
      <dc:creator />
      <dc:date>2014-08-28T12:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use startdate-1 as prev enddate?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670002#M1071723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hofstedt,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the script, that's easy.&lt;/P&gt;&lt;P&gt;You have to sort your table&lt;/P&gt;&lt;P&gt;- in asc. order&amp;nbsp; by person_ID (so all records with the same ID are in one bunch, so to speak)&lt;/P&gt;&lt;P&gt;- in desc. order by date (so the newer date is in front of the older)&lt;/P&gt;&lt;P&gt;=&amp;gt; Then, in another LOAD (might be doable in one, but I like to keep things clear by doing it step-by-step),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; use the PREVIOUS() function to calculate, like &amp;gt; StartDate - 1 &amp;lt; (that would&amp;nbsp; be the start_date of the newer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; period minus one day) and generate an end_date like this.&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 12:33:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670002#M1071723</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2014-08-28T12:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use startdate-1 as prev enddate?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670003#M1071724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Test:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp; Date(Date#(FOMDAT,'YYYY-MM-DD')) as FOMDAT, &lt;/P&gt;&lt;P&gt;&amp;nbsp; Date(Date#(RegisterDate,'YYYY-MM-DD')) as RegisterDate, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EstimateID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Date(Date#(TOMDAT,'YYYY-MM-DD')) = Date(Today()), Null(), Date(Date#(TOMDAT,'YYYY-MM-DD'))) as TOMDAT, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PersonID&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;Tmp5.qvd&lt;/P&gt;&lt;P&gt;(qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;Final:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp; FOMDAT,&lt;/P&gt;&lt;P&gt;&amp;nbsp; TOMDAT,&lt;/P&gt;&lt;P&gt;&amp;nbsp; EstimateID,&lt;/P&gt;&lt;P&gt;&amp;nbsp; RegisterDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(PersonID = Peek(PersonID) and IsNull(TOMDAT), Previous(RegisterDate), TOMDAT) as TOMDATNEW,&lt;/P&gt;&lt;P&gt;&amp;nbsp; PersonID&lt;/P&gt;&lt;P&gt;Resident Test&lt;/P&gt;&lt;P&gt;Order By PersonID, RegisterDate Desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Table Test;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 12:34:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670003#M1071724</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2014-08-28T12:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use startdate-1 as prev enddate?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670004#M1071725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Little change to previous reply....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp; Date(Date#(FOMDAT,'YYYY-MM-DD')) as FOMDAT, &lt;/P&gt;&lt;P&gt;&amp;nbsp; Date(Date#(RegisterDate,'YYYY-MM-DD')) as RegisterDate, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EstimateID, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(Date(Date#(TOMDAT,'YYYY-MM-DD')) = Date(Today()), Null(), Date(Date#(TOMDAT,'YYYY-MM-DD'))) as TOMDAT, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PersonID&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;Tmp5.qvd&lt;/P&gt;&lt;P&gt;(qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;Final:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date(IF(ISNULL(TOMDATNEW),Today(),TOMDATNEW)) as TOMDATNEW2;&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp; FOMDAT,&lt;/P&gt;&lt;P&gt;&amp;nbsp; TOMDAT,&lt;/P&gt;&lt;P&gt;&amp;nbsp; EstimateID,&lt;/P&gt;&lt;P&gt;&amp;nbsp; RegisterDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(PersonID = Peek(PersonID) and IsNull(TOMDAT), Previous(RegisterDate), TOMDAT) as TOMDATNEW,&lt;/P&gt;&lt;P&gt;&amp;nbsp; PersonID&lt;/P&gt;&lt;P&gt;Resident Test&lt;/P&gt;&lt;P&gt;Order By PersonID, RegisterDate Desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop Table Test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;======================&lt;/P&gt;&lt;P&gt;TOMDATNEW2 is the field you want...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 13:03:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670004#M1071725</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2014-08-28T13:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use startdate-1 as prev enddate?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670005#M1071726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please post desired output table also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 13:04:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670005#M1071726</guid>
      <dc:creator>MarcoWedel</dc:creator>
      <dc:date>2014-08-28T13:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use startdate-1 as prev enddate?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670006#M1071727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here I have considered NULL value wherever TOMDAT is today's date....&lt;/P&gt;&lt;P&gt;And replaced it with RegisterDate...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to replace it with FOMDAT.... &lt;/P&gt;&lt;P&gt;use as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; IF(PersonID = Peek(PersonID) and IsNull(TOMDAT), Previous(FOMDAT), TOMDAT) as TOMDATNEW,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;rest all same...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 13:14:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-startdate-1-as-prev-enddate/m-p/670006#M1071727</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2014-08-28T13:14:57Z</dc:date>
    </item>
  </channel>
</rss>

