<?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: Handling facts with a date range. Create a day table or use set analysis? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/579#M122</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Or do I have to go back to my original solution of generating a Day or Month table in the load script?&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, you are right here. You have to create a master calendar table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jan 2018 05:11:56 GMT</pubDate>
    <dc:creator>tresB</dc:creator>
    <dc:date>2018-01-15T05:11:56Z</dc:date>
    <item>
      <title>Handling facts with a date range. Create a day table or use set analysis?</title>
      <link>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/578#M121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Qlik Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a scenario where the Fact in my data is a Booking. Each Booking has a Start Date and an End Date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="DateRange.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/190028_DateRange.PNG" style="height: 155px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to produce reports to show how many Bookings are active at a point in time (eg. on a day, or on a month). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have initially approached this scenario by creating a "Day" table in the Load Script. By this I mean that the original fact table is expanded out so that each line represents one date for the booking. This works well, however it results in a very large dataset in my actual scenario. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am considering an alternate solution (attached in QVW). In this solution, I have a start date and an end date assigned to variables. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then use Set Analysis to count the number of Bookings between my Start and End selection variables (below). This works well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;count(&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;{&amp;lt;&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;StartDate = {"&amp;lt;=$(vSelectionDateEnd)"},&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;EndDate = {"&amp;gt;=$(vSelectionDateStart)"}&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&amp;gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 10pt;"&gt;Name&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG alt="daterange2.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/190029_daterange2.PNG" style="height: 321px; width: 620px;" /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;However, now I would like to create a line chart how many bookings were active by month. Usually this would be easy if I were using a single date value, by using the Month in the Master Calendar table as &lt;SPAN style="font-size: 13.3333px;"&gt;chart dimension&lt;/SPAN&gt;. However, now I have a Date Range rather than a single date on which to link my data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas as to how I could do this using Chart Functions? Or do I have to go back to my original solution of generating a Day or Month table in the load script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Will&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jan 2018 22:49:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/578#M121</guid>
      <dc:creator>william_ericksson</dc:creator>
      <dc:date>2018-01-14T22:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Handling facts with a date range. Create a day table or use set analysis?</title>
      <link>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/579#M122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Or do I have to go back to my original solution of generating a Day or Month table in the load script?&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, you are right here. You have to create a master calendar table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2018 05:11:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/579#M122</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2018-01-15T05:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Handling facts with a date range. Create a day table or use set analysis?</title>
      <link>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/580#M123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to create a master calendar of all the dates.&amp;nbsp; Then use the intervalMatch function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Trips]:&lt;BR /&gt;LOAD * INLINE &lt;BR /&gt;[&lt;BR /&gt;TripName,Start Date,End Date&lt;BR /&gt;Brisbane Meeting,3 mar 2018,4 mar 2018&lt;BR /&gt;Perth Product Launch,3 mar 2018,10 mar 2018&lt;BR /&gt;Managers Retreat,5 mar 2018,8 mar 2018&lt;BR /&gt;product manager global,8 mar 2018,6 may 2018&lt;BR /&gt;Sales Mgr Qld Soujurn,6 mar 2018,8 mar 2018&lt;BR /&gt;](delimiter is ',');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MinMax:&lt;BR /&gt;Load Min([Start Date]) as MinDate,Max([End Date]) as MaxDate Resident Trips;&lt;/P&gt;&lt;P&gt;Let vMin = FieldValue('MinDate',1);&lt;BR /&gt;Let vMax = FieldValue('MaxDate',1);&lt;BR /&gt;Let vDays = vMax-vMin+1;&lt;/P&gt;&lt;P&gt;Drop Table MinMax;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dates:&lt;BR /&gt;Load&lt;BR /&gt; Date($(vMin) + RowNo()-1) as Date&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AutoGenerate ($(vDays));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join (Dates)&lt;BR /&gt;IntervalMatch (Date)&lt;/P&gt;&lt;P&gt;Load [Start Date],[End Date] Resident Trips;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="NoBookings Data Model.PNG" class="jive-image image-2" src="/legacyfs/online/195405_NoBookings Data Model.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="NoBookings.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/195404_NoBookings.PNG" style="width: 620px; height: 270px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2018 04:59:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/580#M123</guid>
      <dc:creator>shanemichelon</dc:creator>
      <dc:date>2018-03-06T04:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Handling facts with a date range. Create a day table or use set analysis?</title>
      <link>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/581#M124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shane,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your helpful response. I have had a play with your solution and it works well. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To take your scenario one step further, let's say that during each Trip there may also be Events that fall on any day within the Trip. If I wanted to count the number of Events using the same master calendar, e.g. the number of events for each month, how would I extend your solution to achieve this? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've added the extra field below...changed the date formatting also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Will&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Trips]:&lt;/P&gt;&lt;P&gt;LOAD * INLINE &lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;P&gt;TripName,Start Date,End Date, EventDate&lt;/P&gt;&lt;P&gt;Brisbane Meeting,3/3/2018,4/3/2018, 4/3/2018&lt;/P&gt;&lt;P&gt;Perth Product Launch,3/3/2018,10/3/2018, 9/3/2018&lt;/P&gt;&lt;P&gt;Managers Retreat,5/3/2018,8/3/2018, 6/3/2018&lt;/P&gt;&lt;P&gt;product manager global,8/3/2018,6/5/2018, 5/5/2018&lt;/P&gt;&lt;P&gt;Sales Mgr Qld Soujurn,6/3/2018,8/3/2018, 7/3/2018&lt;/P&gt;&lt;P&gt;](delimiter is ',');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MinMax:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;Min([Start Date]) as MinDate,&lt;/P&gt;&lt;P&gt;Max([End Date]) as MaxDate &lt;/P&gt;&lt;P&gt;Resident Trips;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vMin = FieldValue('MinDate',1);&lt;/P&gt;&lt;P&gt;Let vMax = FieldValue('MaxDate',1);&lt;/P&gt;&lt;P&gt;Let vDays = vMax-vMin+1;&lt;/P&gt;&lt;P&gt;Drop Table MinMax;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dates:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Date($(vMin) + RowNo()-1) as Date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AutoGenerate ($(vDays));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join (Dates)&lt;/P&gt;&lt;P&gt;IntervalMatch (Date)&lt;/P&gt;&lt;P&gt;Load [Start Date],[End Date] Resident Trips;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Mar 2018 21:08:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Handling-facts-with-a-date-range-Create-a-day-table-or-use-set/m-p/581#M124</guid>
      <dc:creator>william_ericksson</dc:creator>
      <dc:date>2018-03-06T21:08:11Z</dc:date>
    </item>
  </channel>
</rss>

