<?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 Calendars and data formats in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calendars-and-data-formats/m-p/246755#M94034</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a CRM table which houses contract records and I have a calendar script which links to the expiry date. I cannot get the dates to link together because of the source data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I pull through the data from CRM the "expiry date" is in the format dd/mm/yyyy hh:mm. This in itself does not cause the problem. The problem I have is in all the data the time is set to 23:59. So what I would see is 01/10/2011 23:59. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The calendar script (which I have pasted below) created a list of dates with 00:00 as the time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't think that would cause a problem but I think it does. The tables link together but there is no association. It might be a red herring but I don't think so. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;Range:&lt;BR /&gt;LOAD&lt;BR /&gt; min(ConExpiryDate) as contractscalstartdate,&lt;BR /&gt; max(ConExpiryDate) as contractscalenddate&lt;BR /&gt;resident CrmContracts;&lt;/P&gt;&lt;P&gt;//Peek out the values for later use&lt;BR /&gt;let vStart = peek('contractscalstartdate',-1,'Range')-1;&lt;BR /&gt;let vEnd = peek('contractscalenddate',-1,'Range');&lt;BR /&gt;let vRange = $(vEnd) - $(vStart);&lt;/P&gt;&lt;P&gt;//Remove Range table as no longer needed&lt;BR /&gt;Drop table Range;&lt;/P&gt;&lt;P&gt;//Generate a table with a row per date between the range above&lt;BR /&gt;ContractExpiryDateTable:&lt;BR /&gt;Load&lt;BR /&gt; $(vStart)+recno() as ConExpiryDate&lt;BR /&gt;autogenerate $(vRange);&lt;/P&gt;&lt;P&gt;//Calculate the Parts you need to examine&lt;BR /&gt;ContractsExpiryCalendar:&lt;BR /&gt;load&lt;BR /&gt; ConExpiryDate as ConExpiryDate,&lt;BR /&gt;// date(,'dd/mm/yyyy') as Cal_FullDate,&lt;BR /&gt; Year(ConExpiryDate) as ConCalendarYear,&lt;BR /&gt; 'Q'&amp;amp;ceil(Month(ConExpiryDate)/3) AS ConCal_Quarter,&lt;BR /&gt;// right(yearname(Date,0,$(vFiscalMonthStart)),4) as Cal_FiscalYear,&lt;BR /&gt;// if(InYear (Date, $(vToday), -1),1) as Cal_FULL_LY, // All Dates Last Year&lt;BR /&gt;// if(InYear (Date, $(vToday), 0),1) as Cal_FULL_TY, // All Dates This Year&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InYearToDate (ConExpiryDate, today(), 0),1,0) as ConCal_YTD_TY,&amp;nbsp; // All Dates to Date this Year&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InYearToDate (ConExpiryDate, today(), -1),1,0) as ConCal_YTD_LY,&amp;nbsp; // All Dates to Date Last Year&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InQuarterToDate (ConExpiryDate, today(), 0),1,0) as ConCal_QTR_TQ,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InQuarterToDate (ConExpiryDate, today(), -1),1,0) as ConCal_QTR_LQ,&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InMonthToDate(ConExpiryDate, today(), 0),1,0) as ConCal_MNTH_TM,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InMonthToDate(ConExpiryDate, today(), -1),1,0) as ConCal_MNTH_LM,&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;//&amp;nbsp; YTD_LY, used in Expressions Ex. Sum(Sales*YTD_LY)&lt;BR /&gt; quartername(ConExpiryDate) as ConCal_CalendarQuarter,&lt;BR /&gt;// quartername(Date,0,$(vFiscalMonthStart)) as Cal_FiscalQuarter,&lt;BR /&gt;// Month(Date)&amp;amp;'-'&amp;amp;right(yearname(Date,0,11),4) as Cal_FiscalMonthYear, //Fiscal!&lt;BR /&gt; Month(ConExpiryDate)&amp;amp;'-'&amp;amp;right(year(ConExpiryDate),4) as ConCal_MonthYear,&lt;BR /&gt; Month(ConExpiryDate) as ConCal_Month,&lt;BR /&gt; Day(ConExpiryDate) as ConCal_Day,&lt;BR /&gt; Week(ConExpiryDate) as ConCal_Week,&lt;BR /&gt; Weekday(ConExpiryDate) as ConCal_WeekDay&lt;BR /&gt;resident ContractExpiryDateTable;&lt;/P&gt;&lt;P&gt;//Tidy up&lt;BR /&gt;Drop table ContractExpiryDateTable; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Nov 2011 15:09:31 GMT</pubDate>
    <dc:creator>stuwannop</dc:creator>
    <dc:date>2011-11-22T15:09:31Z</dc:date>
    <item>
      <title>Calendars and data formats</title>
      <link>https://community.qlik.com/t5/QlikView/Calendars-and-data-formats/m-p/246755#M94034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a CRM table which houses contract records and I have a calendar script which links to the expiry date. I cannot get the dates to link together because of the source data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I pull through the data from CRM the "expiry date" is in the format dd/mm/yyyy hh:mm. This in itself does not cause the problem. The problem I have is in all the data the time is set to 23:59. So what I would see is 01/10/2011 23:59. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The calendar script (which I have pasted below) created a list of dates with 00:00 as the time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't think that would cause a problem but I think it does. The tables link together but there is no association. It might be a red herring but I don't think so. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;Range:&lt;BR /&gt;LOAD&lt;BR /&gt; min(ConExpiryDate) as contractscalstartdate,&lt;BR /&gt; max(ConExpiryDate) as contractscalenddate&lt;BR /&gt;resident CrmContracts;&lt;/P&gt;&lt;P&gt;//Peek out the values for later use&lt;BR /&gt;let vStart = peek('contractscalstartdate',-1,'Range')-1;&lt;BR /&gt;let vEnd = peek('contractscalenddate',-1,'Range');&lt;BR /&gt;let vRange = $(vEnd) - $(vStart);&lt;/P&gt;&lt;P&gt;//Remove Range table as no longer needed&lt;BR /&gt;Drop table Range;&lt;/P&gt;&lt;P&gt;//Generate a table with a row per date between the range above&lt;BR /&gt;ContractExpiryDateTable:&lt;BR /&gt;Load&lt;BR /&gt; $(vStart)+recno() as ConExpiryDate&lt;BR /&gt;autogenerate $(vRange);&lt;/P&gt;&lt;P&gt;//Calculate the Parts you need to examine&lt;BR /&gt;ContractsExpiryCalendar:&lt;BR /&gt;load&lt;BR /&gt; ConExpiryDate as ConExpiryDate,&lt;BR /&gt;// date(,'dd/mm/yyyy') as Cal_FullDate,&lt;BR /&gt; Year(ConExpiryDate) as ConCalendarYear,&lt;BR /&gt; 'Q'&amp;amp;ceil(Month(ConExpiryDate)/3) AS ConCal_Quarter,&lt;BR /&gt;// right(yearname(Date,0,$(vFiscalMonthStart)),4) as Cal_FiscalYear,&lt;BR /&gt;// if(InYear (Date, $(vToday), -1),1) as Cal_FULL_LY, // All Dates Last Year&lt;BR /&gt;// if(InYear (Date, $(vToday), 0),1) as Cal_FULL_TY, // All Dates This Year&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InYearToDate (ConExpiryDate, today(), 0),1,0) as ConCal_YTD_TY,&amp;nbsp; // All Dates to Date this Year&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InYearToDate (ConExpiryDate, today(), -1),1,0) as ConCal_YTD_LY,&amp;nbsp; // All Dates to Date Last Year&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InQuarterToDate (ConExpiryDate, today(), 0),1,0) as ConCal_QTR_TQ,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InQuarterToDate (ConExpiryDate, today(), -1),1,0) as ConCal_QTR_LQ,&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InMonthToDate(ConExpiryDate, today(), 0),1,0) as ConCal_MNTH_TM,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(InMonthToDate(ConExpiryDate, today(), -1),1,0) as ConCal_MNTH_LM,&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;//&amp;nbsp; YTD_LY, used in Expressions Ex. Sum(Sales*YTD_LY)&lt;BR /&gt; quartername(ConExpiryDate) as ConCal_CalendarQuarter,&lt;BR /&gt;// quartername(Date,0,$(vFiscalMonthStart)) as Cal_FiscalQuarter,&lt;BR /&gt;// Month(Date)&amp;amp;'-'&amp;amp;right(yearname(Date,0,11),4) as Cal_FiscalMonthYear, //Fiscal!&lt;BR /&gt; Month(ConExpiryDate)&amp;amp;'-'&amp;amp;right(year(ConExpiryDate),4) as ConCal_MonthYear,&lt;BR /&gt; Month(ConExpiryDate) as ConCal_Month,&lt;BR /&gt; Day(ConExpiryDate) as ConCal_Day,&lt;BR /&gt; Week(ConExpiryDate) as ConCal_Week,&lt;BR /&gt; Weekday(ConExpiryDate) as ConCal_WeekDay&lt;BR /&gt;resident ContractExpiryDateTable;&lt;/P&gt;&lt;P&gt;//Tidy up&lt;BR /&gt;Drop table ContractExpiryDateTable; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2011 15:09:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calendars-and-data-formats/m-p/246755#M94034</guid>
      <dc:creator>stuwannop</dc:creator>
      <dc:date>2011-11-22T15:09:31Z</dc:date>
    </item>
  </channel>
</rss>

