<?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: Find closest date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038019#M525128</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have a list of EventDates somewhere in your data model, Gysbert's solution will do wonders.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jan 2016 23:58:56 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2016-01-06T23:58:56Z</dc:date>
    <item>
      <title>Find closest date</title>
      <link>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038014#M525123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I have this frustrating task I hope you can help solve:&lt;/P&gt;&lt;P&gt;Known informatoin:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Startdate (presented by red star)&lt;/P&gt;&lt;P&gt;Enddate (presented by the lightning) --&amp;gt; its the startdate + 18 months&lt;/P&gt;&lt;P&gt;Event dates: 1 march and 1 september, every year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Given any startdate, how do I find the&lt;EM&gt; closest future event date&lt;/EM&gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a small picture for visualization:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Udklip.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/110781_Udklip.PNG" style="width: 620px; height: 166px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have tried so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lightningdate = AddMonths(Startdate, 18)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jan 2016 14:58:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038014#M525123</guid>
      <dc:creator>alexbjorlig</dc:creator>
      <dc:date>2016-01-06T14:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Find closest date</title>
      <link>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038015#M525124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe like this: Min( If(EventDate&amp;gt;AddMonths(Startdate,18),EventDate))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jan 2016 17:46:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038015#M525124</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-01-06T17:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Find closest date</title>
      <link>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038016#M525125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the event dates are fixed at March 1 and Sept 1, it seems that finding the next future event from any date is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if(myDate &amp;gt; MakeDate(Year(myDate),9,1), MakeDate(year(myDate)+1, 3, 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;,if(myDate &amp;gt; MakeDate(Year(myDate),3,1), MakeDate(year(myDate), 9, 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;,MakeDate(year(myDate), 3, 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com/" rel="nofollow"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com/" rel="nofollow"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jan 2016 23:40:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038016#M525125</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2016-01-06T23:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Find closest date</title>
      <link>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038017#M525126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does the closest future event date have to be completely outside of the period between StartDate and EndDate? Your drawing seems to imply as much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jan 2016 23:51:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038017#M525126</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-01-06T23:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Find closest date</title>
      <link>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038018#M525127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If so, replace all occurrences of myDate in Rob's formula with the expression you made yourself: &lt;SPAN style="font-family: 'courier new', courier;"&gt;AddMonths(StartDate, 18)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jan 2016 23:56:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038018#M525127</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-01-06T23:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Find closest date</title>
      <link>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038019#M525128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have a list of EventDates somewhere in your data model, Gysbert's solution will do wonders.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jan 2016 23:58:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038019#M525128</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-01-06T23:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Find closest date</title>
      <link>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038020#M525129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt; &lt;SPAN style="color: #000000; font-size: 12pt;"&gt;Thanks for the constructive answers Peter and Rob! &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12pt;"&gt;The following gave me the desired result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(myDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 18) &amp;gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MakeDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(myDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 18)),9,1), &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MakeDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(myDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 18)+1), 3, 1)&lt;BR /&gt; ,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(myDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 18) &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MakeDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(myDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 18)),3,1), &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MakeDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(myDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 18)), 9, 1)&lt;BR /&gt; ,&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;MakeDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AddMonths&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(myDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, 18)), 3, 1)&lt;BR /&gt; )) &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 10:38:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Find-closest-date/m-p/1038020#M525129</guid>
      <dc:creator>alexbjorlig</dc:creator>
      <dc:date>2016-01-21T10:38:02Z</dc:date>
    </item>
  </channel>
</rss>

