<?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: Create timeline from start and end date per dimension in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Create-timeline-from-start-and-end-date-per-dimension/m-p/1600338#M44385</link>
    <description>&lt;P&gt;Hi&amp;nbsp;pascaldijkshoor,&lt;/P&gt;&lt;P&gt;You can do it in two ways.&lt;/P&gt;&lt;P&gt;1. Keep data structure by using &lt;A href="https://help.qlik.com/en-US/sense/June2019/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes/IntervalMatch.htm" target="_blank" rel="noopener"&gt;IntervalMatch&lt;/A&gt; and solve it in front-end.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Data
SampleData:
load 
AssetNumber,Status,date(date#(FromDate,'DD-MM-YY')) as FromDate,date(date#(ToDate,'DD-MM-YY')) as ToDate
Inline [
AssetNumber,Status,FromDate,ToDate
87003,online,01-01-19,24-05-19
87003,offline,25-05-19,09-07-19
87004,online,01-01-19,09-07-19 
87005,online,01-05-19,13-06-19
87005,offline,14-06-19,23-06-19
87005,online,24-06-19,09-07-19
];

// Master Calendar

MinMax:
Load min("FromDate") as MinDate,
	 Max("ToDate") as MaxData
Resident SampleData;

let vMinDate=peek('MinDate',0,'MinMax');
let vMaxDate=peek('MaxData',0,'MinMax');

drop table MinMax;

TempCalendar:
load Date($(vMinDate)+IterNo()-1) as Date
AutoGenerate(1) while $(vMinDate)+IterNo()-1 &amp;lt;= $(vMaxDate);

MasterCalendar:
Load  
               Date AS "Date",  
               week(Date) As Date.Week,  
               Year(Date) As Date.Year,
               'Q'&amp;amp;ceil(month(Date)/3) as Date.Quarter,
               'Q'&amp;amp;ceil(month(Date)/3)&amp;amp;'-'&amp;amp; Year(Date) as Date.QuarterYear,
               Month(Date) As Date.Month,  
               Day(Date) As Date.Day,
               date(monthstart(Date), 'MMM YYYY') as Date.MonthYear
Resident TempCalendar  
Order By Date ASC; 

Drop Table TempCalendar;

// IntervalMatch

Inner Join IntervalMatch ( Date ) 
LOAD FromDate, ToDate
Resident SampleData;&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled1.png" style="width: 317px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/15134i385C62E2417F1565/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled1.png" alt="Untitled1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2 - Create the output Table on script side by using a simple while loop.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Output:
Load
      AssetNumber as Out.AssetNumber,Status as Out.Status,
      Date( FromDate + IterNo() - 1 ) as Out.Date
      Resident SampleData
      While IterNo() &amp;lt;= ToDate - FromDate + 1 ;&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled2.png" style="width: 385px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/15135i1C6E6C20A0158B3F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled2.png" alt="Untitled2.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/15136i3FA5F38C94E794DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled.png" alt="Untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can choose the best way based on your need. You can also check the attached qvf.&lt;/P&gt;&lt;P&gt;Hope it helps...&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2019 11:07:18 GMT</pubDate>
    <dc:creator>kaanerisen</dc:creator>
    <dc:date>2019-07-09T11:07:18Z</dc:date>
    <item>
      <title>Create timeline from start and end date per dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Create-timeline-from-start-and-end-date-per-dimension/m-p/1600305#M44383</link>
      <description>&lt;P&gt;I have got a table with the following fields and an example of some of the lines included:&amp;nbsp;&lt;/P&gt;&lt;P&gt;AssetNumber | Status | FromDate | ToDate&lt;BR /&gt;87003 | online | 01-01-19 | 24-05-19&lt;BR /&gt;87003 | offline | 25-05-19 | 09-07-19 (today's date)&lt;BR /&gt;87004 | online | 01-01-19 | 09-07-19&amp;nbsp;&lt;BR /&gt;87005 | online | 01-05-19 | 13-06-19&lt;BR /&gt;87005 | offline | 14-06-19 | 23-06-19&lt;BR /&gt;87005 | online | 24-06-19 | 09-07-19&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to convert this table to a table with a timeline with one datefield. So it should look like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;NewDateField | AssetNumber | Status&lt;/P&gt;&lt;P&gt;01-01-19 | 87003 | online&lt;BR /&gt;02-01-19 | 87003 | online&lt;BR /&gt;03-01-19 | 87003 | online&lt;BR /&gt;... ... ...&amp;nbsp;&lt;BR /&gt;24-05-19 | 87003 | online&lt;BR /&gt;25-05-19 | 87003 | &lt;STRONG&gt;offline&lt;/STRONG&gt;&lt;BR /&gt;26-05-19 | 87003 | offline&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on, and this for every AssetNumber.&lt;/P&gt;&lt;P&gt;So the new table should contain for every AssetNumber a range of all the dates from the FromDate to the ToDate, together with the corresponding status.&lt;/P&gt;&lt;P&gt;Can anyone help me with this?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 10:14:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Create-timeline-from-start-and-end-date-per-dimension/m-p/1600305#M44383</guid>
      <dc:creator>pascaldijkshoor</dc:creator>
      <dc:date>2019-07-09T10:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create timeline from start and end date per dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Create-timeline-from-start-and-end-date-per-dimension/m-p/1600338#M44385</link>
      <description>&lt;P&gt;Hi&amp;nbsp;pascaldijkshoor,&lt;/P&gt;&lt;P&gt;You can do it in two ways.&lt;/P&gt;&lt;P&gt;1. Keep data structure by using &lt;A href="https://help.qlik.com/en-US/sense/June2019/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes/IntervalMatch.htm" target="_blank" rel="noopener"&gt;IntervalMatch&lt;/A&gt; and solve it in front-end.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Data
SampleData:
load 
AssetNumber,Status,date(date#(FromDate,'DD-MM-YY')) as FromDate,date(date#(ToDate,'DD-MM-YY')) as ToDate
Inline [
AssetNumber,Status,FromDate,ToDate
87003,online,01-01-19,24-05-19
87003,offline,25-05-19,09-07-19
87004,online,01-01-19,09-07-19 
87005,online,01-05-19,13-06-19
87005,offline,14-06-19,23-06-19
87005,online,24-06-19,09-07-19
];

// Master Calendar

MinMax:
Load min("FromDate") as MinDate,
	 Max("ToDate") as MaxData
Resident SampleData;

let vMinDate=peek('MinDate',0,'MinMax');
let vMaxDate=peek('MaxData',0,'MinMax');

drop table MinMax;

TempCalendar:
load Date($(vMinDate)+IterNo()-1) as Date
AutoGenerate(1) while $(vMinDate)+IterNo()-1 &amp;lt;= $(vMaxDate);

MasterCalendar:
Load  
               Date AS "Date",  
               week(Date) As Date.Week,  
               Year(Date) As Date.Year,
               'Q'&amp;amp;ceil(month(Date)/3) as Date.Quarter,
               'Q'&amp;amp;ceil(month(Date)/3)&amp;amp;'-'&amp;amp; Year(Date) as Date.QuarterYear,
               Month(Date) As Date.Month,  
               Day(Date) As Date.Day,
               date(monthstart(Date), 'MMM YYYY') as Date.MonthYear
Resident TempCalendar  
Order By Date ASC; 

Drop Table TempCalendar;

// IntervalMatch

Inner Join IntervalMatch ( Date ) 
LOAD FromDate, ToDate
Resident SampleData;&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled1.png" style="width: 317px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/15134i385C62E2417F1565/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled1.png" alt="Untitled1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2 - Create the output Table on script side by using a simple while loop.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Output:
Load
      AssetNumber as Out.AssetNumber,Status as Out.Status,
      Date( FromDate + IterNo() - 1 ) as Out.Date
      Resident SampleData
      While IterNo() &amp;lt;= ToDate - FromDate + 1 ;&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled2.png" style="width: 385px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/15135i1C6E6C20A0158B3F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled2.png" alt="Untitled2.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/15136i3FA5F38C94E794DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled.png" alt="Untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can choose the best way based on your need. You can also check the attached qvf.&lt;/P&gt;&lt;P&gt;Hope it helps...&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 11:07:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Create-timeline-from-start-and-end-date-per-dimension/m-p/1600338#M44385</guid>
      <dc:creator>kaanerisen</dc:creator>
      <dc:date>2019-07-09T11:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create timeline from start and end date per dimension</title>
      <link>https://community.qlik.com/t5/App-Development/Create-timeline-from-start-and-end-date-per-dimension/m-p/1600760#M44434</link>
      <description>&lt;P&gt;The scripts work perfectly. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 07:59:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Create-timeline-from-start-and-end-date-per-dimension/m-p/1600760#M44434</guid>
      <dc:creator>pascaldijkshoor</dc:creator>
      <dc:date>2019-07-10T07:59:48Z</dc:date>
    </item>
  </channel>
</rss>

