<?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: Problem with calculating months difference between 2 dates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991075#M337713</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It should work. I have tested it as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=((year(today(2))*12)+month(today(2))) - (((year(today()-3)*12)+month(today()-3))) &lt;/P&gt;&lt;P&gt;which is returning zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may need to verify if the Effective date is being null or any other ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hemanth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Dec 2015 15:29:10 GMT</pubDate>
    <dc:creator>hemhund2016</dc:creator>
    <dc:date>2015-12-10T15:29:10Z</dc:date>
    <item>
      <title>Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991074#M337712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I am using the following expression to calculate the months difference between today and the EFFECTIVE_DATE, but when the two dates are within the same month, the expression is failing instead of returning 0.&amp;nbsp; Any ideas?&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;year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;today&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(2))*12)+&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;month&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;today&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(2))) - (((&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: #800000; font-size: 8pt;"&gt;EFFECTIVE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)*12)+&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;month&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EFFECTIVE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Thanks much!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 15:23:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991074#M337712</guid>
      <dc:creator>triciagdaly</dc:creator>
      <dc:date>2015-12-10T15:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991075#M337713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It should work. I have tested it as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=((year(today(2))*12)+month(today(2))) - (((year(today()-3)*12)+month(today()-3))) &lt;/P&gt;&lt;P&gt;which is returning zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may need to verify if the Effective date is being null or any other ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hemanth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 15:29:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991075#M337713</guid>
      <dc:creator>hemhund2016</dc:creator>
      <dc:date>2015-12-10T15:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991076#M337714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=RangeSum(((year(today(2))*12)+month(today(2))), -((year(EFFECTIVE_DATE)*12)+month(EFFECTIVE_DATE)))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 15:43:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991076#M337714</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-12-10T15:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991077#M337715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, it's not returning the row with the two dates in the same month.&amp;nbsp; Strange that I can separate this expression into two and then take a difference using fabs(end date-start date) and it works.&amp;nbsp; But can't do in one expression.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="screen shot.PNG" class="jive-image image-1" src="/legacyfs/online/108659_screen shot.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works but would rather have it in one expression and don't understand why it's not returning the row when it's in one expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;end date:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&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;today&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(2))*12)+&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;month&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;today&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(2)))&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;start date:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&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: #800000; font-size: 8pt;"&gt;EFFECTIVE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)*12)+&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;month&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;EFFECTIVE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;month difference&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[end date]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;-&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[start date]&lt;/SPAN&gt;&lt;STRONG style=": ; color: #ff8000; font-size: 8pt; text-decoration: underline;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:00:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991077#M337715</guid>
      <dc:creator>triciagdaly</dc:creator>
      <dc:date>2015-12-10T16:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991078#M337716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;disregard the fabs() on the last reply.. do not need the absolute value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:09:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991078#M337716</guid>
      <dc:creator>triciagdaly</dc:creator>
      <dc:date>2015-12-10T16:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991079#M337717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can't you use an expression like this one?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=num((today() - EFECTIVE_DATE)/30, '0')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:20:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991079#M337717</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-12-10T16:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991080#M337718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;((year(today(2))*12)+month(today(2)))-&lt;/P&gt;&lt;P&gt;((year(End)*12)+month(End))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/108660_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br,&lt;/P&gt;&lt;P&gt;Miikka&lt;/P&gt;&lt;P&gt;Climber Finland&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:31:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991080#M337718</guid>
      <dc:creator>miikkaqlick</dc:creator>
      <dc:date>2015-12-10T16:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991081#M337719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hemantha,&lt;/P&gt;&lt;P&gt;Where is the EFFECTIVE_DATE in your example?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:51:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991081#M337719</guid>
      <dc:creator>triciagdaly</dc:creator>
      <dc:date>2015-12-10T16:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991082#M337720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jose,&lt;/P&gt;&lt;P&gt;This is rounding up always versus when it gets to midpoint in month.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 16:57:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991082#M337720</guid>
      <dc:creator>triciagdaly</dc:creator>
      <dc:date>2015-12-10T16:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991083#M337721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tricia,&lt;/P&gt;&lt;P&gt;Your expression had a lot of superfluous brackets that I've removed plus a couple that were incorrect that I've kept but remarked out to show where they were:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;year(today(2))*12&lt;/P&gt;&lt;P&gt;// )&lt;/P&gt;&lt;P&gt;+month(today(2))&lt;/P&gt;&lt;P&gt;// )&lt;/P&gt;&lt;P&gt; - year(EFFECTIVE_DATE)*12+month(EFFECTIVE_DATE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway here's another expression to try (you can't have too many!)&lt;/P&gt;&lt;P&gt;=12*(Year(today(2)) - Year(&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10.6667px;"&gt;EFFECTIVE_DATE&lt;/SPAN&gt;)) + Month(today(2)) - Month(&lt;SPAN style="color: #800000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10.6667px;"&gt;EFFECTIVE_DATE&lt;/SPAN&gt;))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 17:20:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991083#M337721</guid>
      <dc:creator>effinty2112</dc:creator>
      <dc:date>2015-12-10T17:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with calculating months difference between 2 dates</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991084#M337722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you all for your input.&amp;nbsp; The only thing that seems to work is to put the original expression in the load script.&amp;nbsp; Not sure why the expression will not work, but I surrender to the quirks of qlikview &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2015 19:06:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-calculating-months-difference-between-2-dates/m-p/991084#M337722</guid>
      <dc:creator>triciagdaly</dc:creator>
      <dc:date>2015-12-10T19:06:06Z</dc:date>
    </item>
  </channel>
</rss>

