<?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 Number of years / AddYears function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Number-of-years-AddYears-function/m-p/455415#M169988</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking at the AddYears() function - and trying to calculate the number of years an application has been active (Effective Date).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(AddYears(Effective Date, 0), 'YYYY' - I'm trying to think of the logic to be able to display as such:&lt;/P&gt;&lt;P&gt;within one year of current date = 0&lt;/P&gt;&lt;P&gt;greater than one year, less than 2 = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on - what function(s) do I need to set up in the script?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Oct 2012 19:07:29 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-10-25T19:07:29Z</dc:date>
    <item>
      <title>Number of years / AddYears function</title>
      <link>https://community.qlik.com/t5/QlikView/Number-of-years-AddYears-function/m-p/455415#M169988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking at the AddYears() function - and trying to calculate the number of years an application has been active (Effective Date).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(AddYears(Effective Date, 0), 'YYYY' - I'm trying to think of the logic to be able to display as such:&lt;/P&gt;&lt;P&gt;within one year of current date = 0&lt;/P&gt;&lt;P&gt;greater than one year, less than 2 = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on - what function(s) do I need to set up in the script?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 19:07:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Number-of-years-AddYears-function/m-p/455415#M169988</guid>
      <dc:creator />
      <dc:date>2012-10-25T19:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Number of years / AddYears function</title>
      <link>https://community.qlik.com/t5/QlikView/Number-of-years-AddYears-function/m-p/455416#M169989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To calculate number of months you can use&lt;/P&gt;&lt;P&gt;=((Year(EndDate) * 12) + Month(EndDate)) - ((Year(StartDate) * 12) + Month(StartDate))&lt;/P&gt;&lt;P&gt;divide this by 12 and use as you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use it as function also like&lt;/P&gt;&lt;P&gt;SET MonthDiff = Num(((Year($2) * 12) + Month($2)) - ((Year($1) * 12) + Month($1)));&lt;/P&gt;&lt;P&gt; then you can use this as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(MonthDiff(startdate, enddate)) to compute.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2012 19:48:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Number-of-years-AddYears-function/m-p/455416#M169989</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-10-25T19:48:49Z</dc:date>
    </item>
  </channel>
</rss>

