<?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 Num years in decimal in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178469#M45660</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This comes up often enough that it would be very nice if QlikView would add a monthsbetween() function. Until then, I use this for monthsbetween(date1,date2):&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;= year(date2)*12 + month(date2) - year(date1)*12 - month(date1)&lt;BR /&gt;+ day(date2) / (monthstart(date2,1) - monthstart(date2))&lt;BR /&gt;- (day(date1)-1) / (monthstart(date1,1) - monthstart(date1))&lt;/P&gt;&lt;P&gt;Divide by 12 for the years.&lt;/P&gt;&lt;P&gt;That said, I'm calculating the number INCLUDING both dates, for 3652 days, not 3651 days. So I'm getting 9.9972222222 instead of 9.9946235. And you can't just subtract a day out, because it can matter which month and year that day is in. Still, it shouldn't be too hard to modify the expression if you're sure you want to exclude one of the dates, or count it as going from noon to noon on those dates, or whatever you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Sep 2009 05:52:52 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2009-09-09T05:52:52Z</dc:date>
    <item>
      <title>Num years in decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178466#M45657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;How is it possible to get the number of years between 2 days to also include the decimal amount?&lt;/P&gt;&lt;P&gt;e.g. i have 2 dates. 02/09/1999 and 31/08/2009.&lt;/P&gt;&lt;P&gt;The number of days between these dates is 3651. and if I divide this by 365 I get 10.0027397260274 which is incorrect as it does not take into consideration the leap years.The correct value should be 9.99462365359067&lt;/P&gt;&lt;P&gt;Other development tools you can do a monthsbetween function and simply divide by 12 but this is not available in Qlikview!!&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Kevin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2009 17:06:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178466#M45657</guid>
      <dc:creator />
      <dc:date>2009-09-08T17:06:10Z</dc:date>
    </item>
    <item>
      <title>Num years in decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178467#M45658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need the (integer) number of years between two dates, the age() function should do the job.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2009 18:32:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178467#M45658</guid>
      <dc:creator />
      <dc:date>2009-09-08T18:32:57Z</dc:date>
    </item>
    <item>
      <title>Num years in decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178468#M45659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;As I've stated above is that I need the real (decimal) value not the integer value.&lt;/P&gt;&lt;P&gt;This is why I put the post up.&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;Kevin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2009 19:54:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178468#M45659</guid>
      <dc:creator />
      <dc:date>2009-09-08T19:54:01Z</dc:date>
    </item>
    <item>
      <title>Num years in decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178469#M45660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This comes up often enough that it would be very nice if QlikView would add a monthsbetween() function. Until then, I use this for monthsbetween(date1,date2):&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;= year(date2)*12 + month(date2) - year(date1)*12 - month(date1)&lt;BR /&gt;+ day(date2) / (monthstart(date2,1) - monthstart(date2))&lt;BR /&gt;- (day(date1)-1) / (monthstart(date1,1) - monthstart(date1))&lt;/P&gt;&lt;P&gt;Divide by 12 for the years.&lt;/P&gt;&lt;P&gt;That said, I'm calculating the number INCLUDING both dates, for 3652 days, not 3651 days. So I'm getting 9.9972222222 instead of 9.9946235. And you can't just subtract a day out, because it can matter which month and year that day is in. Still, it shouldn't be too hard to modify the expression if you're sure you want to exclude one of the dates, or count it as going from noon to noon on those dates, or whatever you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 05:52:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178469#M45660</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-09-09T05:52:52Z</dc:date>
    </item>
    <item>
      <title>Num years in decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178470#M45661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;Thats exactly what I needed thanks.&lt;/P&gt;&lt;P&gt;Kevin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 20:43:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Num-years-in-decimal/m-p/178470#M45661</guid>
      <dc:creator />
      <dc:date>2009-09-09T20:43:23Z</dc:date>
    </item>
  </channel>
</rss>

