<?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: Check if a date is within a certain range in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Check-if-a-date-is-within-a-certain-range/m-p/630043#M231251</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or, as a variation, create two calendar objects and attach them to two variables, for instance vStartPeriod and vEndPeriod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan's expression then becomes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ((my_date &amp;gt;= '$(vStartPeriod)') and (my_date &amp;lt;= '$(vEndPeriod)'), 'YES', 'NO')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if you want the period to be always exactly 12 months long, start from the first variable (drop the second variable and calendar object) by doing this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ((my_date &amp;gt;= '$(vStartPeriod)') and (my_date &amp;lt; AddMonths('$(vStartPeriod)', 12)) 'YES', 'NO')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 May 2014 00:38:46 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2014-05-28T00:38:46Z</dc:date>
    <item>
      <title>Check if a date is within a certain range</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-a-date-is-within-a-certain-range/m-p/630041#M231249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please show me what I can do to validate if a certain date (e.g. my_date) is within a date range?&lt;/P&gt;&lt;P&gt;I saw the function InYearToDate(). However this only checks if the my_date is part of the year containing the basedate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is what if the date range that I want to use spans 2 different years? &lt;/P&gt;&lt;P&gt;A real life example will be a Fiscal Calendar. &lt;/P&gt;&lt;P&gt;For instance, from May 2013 to April 2014 is my Fiscal Calendar.&amp;nbsp; Now, I need to check if my_date falls within this Fiscal Calendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 21:45:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-a-date-is-within-a-certain-range/m-p/630041#M231249</guid>
      <dc:creator />
      <dc:date>2014-05-27T21:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a date is within a certain range</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-a-date-is-within-a-certain-range/m-p/630042#M231250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(my_date &amp;gt;= makedate(2013,5,1) and my_date &amp;lt;= makedate(2014,4,30), 'Yes','No')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example used in a load script or expression in a chart with dimension my_date.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 21:55:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-a-date-is-within-a-certain-range/m-p/630042#M231250</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-05-27T21:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a date is within a certain range</title>
      <link>https://community.qlik.com/t5/QlikView/Check-if-a-date-is-within-a-certain-range/m-p/630043#M231251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or, as a variation, create two calendar objects and attach them to two variables, for instance vStartPeriod and vEndPeriod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan's expression then becomes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ((my_date &amp;gt;= '$(vStartPeriod)') and (my_date &amp;lt;= '$(vEndPeriod)'), 'YES', 'NO')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if you want the period to be always exactly 12 months long, start from the first variable (drop the second variable and calendar object) by doing this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF ((my_date &amp;gt;= '$(vStartPeriod)') and (my_date &amp;lt; AddMonths('$(vStartPeriod)', 12)) 'YES', 'NO')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 00:38:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Check-if-a-date-is-within-a-certain-range/m-p/630043#M231251</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2014-05-28T00:38:46Z</dc:date>
    </item>
  </channel>
</rss>

