<?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: Date period problem... in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Date-period-problem/m-p/1697440#M451015</link>
    <description>&lt;P&gt;Hi &lt;STRIKE&gt;Paul&amp;nbsp;&lt;/STRIKE&gt;Peter, this script can do the trick:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;GL_TABLE:
LOAD Studentnr, Date(Date#(Startdate, 'DD-MM-YYYY')) as Startdate, Date(Date#(Enddate, 'DD-MM-YYYY')) as Enddate INLINE [
Studentnr,      Startdate,   Enddate
1,                        3-4-2020,      10-4-2020
1,                        18-4-2020,   20-4-2020
2,                       13-4-2020 ,   14-4-2020
2,                       14-4-2020,    15-4-2020
2,                       15-4-2020,   18-4-2020
];

ProcessData:
NoConcatenate
LOAD
	Studentnr,
	If(Peek(Studentnr)=Studentnr and Startdate&amp;lt;=Peek(Enddate), Peek(Startdate), Startdate) as Startdate,
	Enddate
Resident GL_TABLE
Order by Studentnr, Startdate;

EndData:
NoConcatenate
LOAD
	*,
	Enddate-Startdate+1 as Duration
;
LOAD
	Studentnr,
	Startdate,
	Max(Enddate) as Enddate
Resident ProcessData
Group by Studentnr, Startdate;

DROP Table GL_TABLE;
DROP Table ProcessData;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Apr 2020 07:33:03 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2020-04-30T07:33:03Z</dc:date>
    <item>
      <title>Date period problem...</title>
      <link>https://community.qlik.com/t5/QlikView/Date-period-problem/m-p/1697425#M451013</link>
      <description>&lt;P&gt;Hi to you all,&lt;/P&gt;&lt;P&gt;I've got the following dataset:&lt;/P&gt;&lt;P&gt;Studentnr&amp;nbsp; &amp;nbsp; &amp;nbsp; Startdate&amp;nbsp; &amp;nbsp;Enddate&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3-4-2020&amp;nbsp; &amp;nbsp; &amp;nbsp; 10-4-2020&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18-4-2020&amp;nbsp; &amp;nbsp;20-2-2020&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13-4-2020&amp;nbsp; &amp;nbsp; 14-4-2020&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;14-4-2020&amp;nbsp; &amp;nbsp; 15-4-2020&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15-4-2020&amp;nbsp; &amp;nbsp;18-4-2020&lt;/P&gt;&lt;P&gt;The result shoult look like this&lt;/P&gt;&lt;P&gt;Studentnr&amp;nbsp; &amp;nbsp; &amp;nbsp; Startdate&amp;nbsp; &amp;nbsp;Enddate&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Duration in day's&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3-4-2020&amp;nbsp; &amp;nbsp; &amp;nbsp; 10-4-2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 18-4-2020&amp;nbsp; &amp;nbsp;20-2-2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13-4-2020&amp;nbsp; &amp;nbsp; 18-4-2020&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/P&gt;&lt;P&gt;I thought to solve this with previous() of peek(), but I cann't get it working. Who has a clue for me?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 14:24:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-period-problem/m-p/1697425#M451013</guid>
      <dc:creator>piekepotloed</dc:creator>
      <dc:date>2020-04-28T14:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Date period problem...</title>
      <link>https://community.qlik.com/t5/QlikView/Date-period-problem/m-p/1697440#M451015</link>
      <description>&lt;P&gt;Hi &lt;STRIKE&gt;Paul&amp;nbsp;&lt;/STRIKE&gt;Peter, this script can do the trick:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;GL_TABLE:
LOAD Studentnr, Date(Date#(Startdate, 'DD-MM-YYYY')) as Startdate, Date(Date#(Enddate, 'DD-MM-YYYY')) as Enddate INLINE [
Studentnr,      Startdate,   Enddate
1,                        3-4-2020,      10-4-2020
1,                        18-4-2020,   20-4-2020
2,                       13-4-2020 ,   14-4-2020
2,                       14-4-2020,    15-4-2020
2,                       15-4-2020,   18-4-2020
];

ProcessData:
NoConcatenate
LOAD
	Studentnr,
	If(Peek(Studentnr)=Studentnr and Startdate&amp;lt;=Peek(Enddate), Peek(Startdate), Startdate) as Startdate,
	Enddate
Resident GL_TABLE
Order by Studentnr, Startdate;

EndData:
NoConcatenate
LOAD
	*,
	Enddate-Startdate+1 as Duration
;
LOAD
	Studentnr,
	Startdate,
	Max(Enddate) as Enddate
Resident ProcessData
Group by Studentnr, Startdate;

DROP Table GL_TABLE;
DROP Table ProcessData;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Apr 2020 07:33:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-period-problem/m-p/1697440#M451015</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2020-04-30T07:33:03Z</dc:date>
    </item>
  </channel>
</rss>

