<?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: Field association with datetime and master calendar. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Field-association-with-datetime-and-master-calendar/m-p/466733#M697335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace;"&gt;Date(A) as Cofely.Datum,&lt;/SPAN&gt; does not remove the time fraction of the datetime. The date function only changes the formatting. You'll want to use the floor function to create a date without time fraction. And frac for time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(floor(A)) as Cofely.Datum&lt;/P&gt;&lt;P&gt;Time(frac(A)) as Cofely.Tijd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Feb 2013 14:46:42 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-02-25T14:46:42Z</dc:date>
    <item>
      <title>Field association with datetime and master calendar.</title>
      <link>https://community.qlik.com/t5/QlikView/Field-association-with-datetime-and-master-calendar/m-p/466732#M697334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Qlikview users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an excelsheet with temperatur and energy data. All energy and temperature values are registred every hour of a day. &lt;SPAN style="font-size: 10pt;"&gt;I want to make use of a Master Calendar to be able to filter the data on specific days and hours. However, when I import the data of the sheet, the associations between this data and the fields of the master calendar are not exactly how I want it. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Before I go into the details, I want to give you an impression of the data and script.&lt;BR /&gt;I've added it below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Excelsheet with data (click to expand):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="33842" alt="qv_data_ex.PNG" class="jive-image-thumbnail jive-image" height="174" src="https://community.qlik.com/legacyfs/online/33842_qv_data_ex.PNG" style="height: 174.38189533239037px; width: 467px;" width="467" /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13617871020999712" jivemacro_uid="_13617871020999712"&gt;&lt;P&gt;&lt;STRONG&gt;Script for importing excelsheet:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13617871020987934" jivemacro_uid="_13617871020987934"&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13617871020988996" jivemacro_uid="_13617871020988996"&gt;&lt;P&gt;Cofely:&lt;/P&gt;&lt;P&gt;LOAD timestamp#(Date(A) &amp;amp; ' ' &amp;amp; Time(A),'DD/MM/YYYY hh:mm:ss') as Cofely.DatumTijd, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B as Cofely.Dag, // Day&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C as Cofely.Uur, // Hour&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; D as Cofely.BuitenTemperatuur, // Temperature&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; G as Cofely.Elektrisch, // Energy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; H as Cofely.Gas, // Gas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(A) as Cofely.Datum, // Date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Time(A) as Cofely.Tijd&amp;nbsp; // Time&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;C&gt;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;(ooxml, explicit labels, header is 3 lines, table is Blad1);&lt;/P&gt;&lt;/PRE&gt;
&lt;/PRE&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mastercalendar snippet:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13617871020964827" jivemacro_uid="_13617871020964827"&gt;&lt;P&gt;QuartersMap:&lt;/P&gt;&lt;P&gt;MAPPING LOAD &lt;/P&gt;&lt;P&gt;rowno() as Month,&lt;/P&gt;&lt;P&gt;'Kw' &amp;amp; Ceil (rowno()/3) as Quarter&lt;/P&gt;&lt;P&gt;AUTOGENERATE (12);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Date(date#('01-01-2010','DD-MM-YYYY')) as minDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Today() as maxDate&lt;/P&gt;&lt;P&gt;Resident Cofely;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let varMinDate = Num(Peek('minDate', 0, 'Temp'));&lt;/P&gt;&lt;P&gt;Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));&lt;/P&gt;&lt;P&gt;DROP Table Temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempCalendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(varMinDate) + Iterno()-1 As Num,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date($(varMinDate) + IterNo() - 1) as TempDate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AutoGenerate 1 While $(varMinDate) + IterNo() -1 &amp;lt;= $(varMaxDate);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MasterCalendar:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; TempDate AS Cofely.Datum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; week(TempDate) As Calendar.Week,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Year(TempDate) As Calendar.Jaar,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Month(TempDate) As Calendar.Maand,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Day(TempDate) As Calendar.Dag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; YeartoDate(TempDate)*-1 as Calendar.HuidigYTDFlag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; YeartoDate(TempDate,-1)*-1 as Calendar.LaatsteYTDFlag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; inyear(TempDate, Monthstart($(varMaxDate)),-1) as Calendar.RC12,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; date(monthstart(TempDate), 'MMM-YYYY') as Calendar.MaandJaar,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ApplyMap('QuartersMap', month(TempDate), Null()) as Calendar.Kwartaal,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Week(weekstart(TempDate)) &amp;amp; '-' &amp;amp; WeekYear(TempDate) as Calendar.WeekJaar,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if(weekday(TempDate) &amp;lt; 5, 'Werkdagen', 'Weekend') as Calendar.PeriodeType,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; WeekDay(TempDate) as Calendar.WeekDag&lt;/P&gt;&lt;P&gt;Resident TempCalendar&lt;/P&gt;&lt;P&gt;Order By TempDate ASC;&lt;/P&gt;&lt;P&gt;Drop Table TempCalendar;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see in the excelsheet, on every row there is a datetime column which represents the date and every hour of that day.&lt;BR /&gt;The master calendar is linked with the "Cofely.Datum"-column (which is only the date). The result of this is that there are multiple date-values.&lt;BR /&gt;For example, the value "01-01-2010" occurs multiple times, because this datevalue exists for every hour.&lt;BR /&gt;So when i select the first "01-01-2010" it is linked to "1:00" hour (24h format) . The second "01-01-2010" is linked to "2:00" hour etc. etc.&lt;/P&gt;&lt;P&gt;I've added an example below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Association example;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="33839" alt="qv_ex.PNG" class="jive-image" src="https://community.qlik.com/legacyfs/online/33839_qv_ex.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to achieve the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;When I select a date, all hours must be selected in it (1:00 - 24:00)&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because, for my application I need to filter the data:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Per chosen day period&lt;/LI&gt;&lt;LI&gt;Per chosen time period &lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How can I achieve this?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope to find a suitable solution. When something is not clear, I will try to clarify it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 10:07:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Field-association-with-datetime-and-master-calendar/m-p/466732#M697334</guid>
      <dc:creator />
      <dc:date>2013-02-25T10:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Field association with datetime and master calendar.</title>
      <link>https://community.qlik.com/t5/QlikView/Field-association-with-datetime-and-master-calendar/m-p/466733#M697335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace;"&gt;Date(A) as Cofely.Datum,&lt;/SPAN&gt; does not remove the time fraction of the datetime. The date function only changes the formatting. You'll want to use the floor function to create a date without time fraction. And frac for time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(floor(A)) as Cofely.Datum&lt;/P&gt;&lt;P&gt;Time(frac(A)) as Cofely.Tijd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 14:46:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Field-association-with-datetime-and-master-calendar/m-p/466733#M697335</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-02-25T14:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Field association with datetime and master calendar.</title>
      <link>https://community.qlik.com/t5/QlikView/Field-association-with-datetime-and-master-calendar/m-p/466734#M697336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&lt;BR /&gt;That did the trick!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 20:12:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Field-association-with-datetime-and-master-calendar/m-p/466734#M697336</guid>
      <dc:creator />
      <dc:date>2013-02-25T20:12:53Z</dc:date>
    </item>
  </channel>
</rss>

