<?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: Calculate number of months occurring in current year only in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236576#M855759</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be like this&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: line-through;"&gt;Num(Month([End date])) as NoOfMonths&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Feb 2017 13:03:43 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2017-02-08T13:03:43Z</dc:date>
    <item>
      <title>Calculate number of months occurring in current year only</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236575#M855758</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;I have 2 date columns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Start Date and End Date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp; Start date&amp;nbsp;&amp;nbsp;&amp;nbsp; End date&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1-Nov-16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31-Jul-17&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; 1-Aug-17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31-Jul-18&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here I have to calculate number of months occurring in 2017 only.Output should be as below &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;ID&amp;nbsp;&amp;nbsp; Start date&amp;nbsp;&amp;nbsp;&amp;nbsp; End date&amp;nbsp;&amp;nbsp; NoOfMonths&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1-Nov-16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31-Jul-17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (b/w Nov-2016 and Jul 2017&amp;nbsp; total&amp;nbsp; 7 months are in 2017)&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; 1-Aug-17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31-Jul-18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;(b/w Aug-2017 and Jul 2018&amp;nbsp; &lt;SPAN style="font-size: 13.3333px;"&gt;total&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; 5 months are in 2017)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I put this in script ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236575#M855758</guid>
      <dc:creator>apthansh</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate number of months occurring in current year only</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236576#M855759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be like this&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: line-through;"&gt;Num(Month([End date])) as NoOfMonths&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 13:03:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236576#M855759</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-02-08T13:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate number of months occurring in current year only</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236577#M855760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;=((year([&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;End date]&lt;/SPAN&gt;)*12)+month([&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;End date]&lt;/SPAN&gt;)) - (((year([&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;Start date&lt;/SPAN&gt;])*12)+month([&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;Start date&lt;/SPAN&gt;])))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;This basically creates a numeric 'period' for each date and takes one from the other&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;whoops didn't notice the 'only in 2017 bit'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;=&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;(if(&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;End date&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;] &amp;gt; yearend(Today()), &lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;(((year(&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;yearend(Today())&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;)*12)+month(&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;yearendt(Today())&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;)))&lt;/SPAN&gt;,&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;(((year([&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;End date&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;])*12)+month([&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;End date&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;])))&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;- &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: arial, helvetica, sans-serif;"&gt;(if(&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;Start date&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;] &amp;lt; yearstart(Today()), &lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;(((year(&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;yearstart(Today())&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;)*12)+month(&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;yearstart(Today())&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;)))&lt;/SPAN&gt;,&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;(((year([&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;Start date&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;])*12)+month([&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;Start date&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px;"&gt;])))&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 13:07:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236577#M855760</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2017-02-08T13:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate number of months occurring in current year only</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236578#M855761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If([Start date] &amp;gt;= MakeDate(Year(Today())),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If([End date] &amp;lt; MakeDate(Year(Today()) + 1), Month([End date]) - Month([Start date]), 12 - Month([Start date]) + 1),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If([End date] &amp;lt; MakeDate(Year(Today()) + 1), Num(Month([End date])), 12)) as NoOfMonths;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ID,&amp;nbsp; Start date,&amp;nbsp;&amp;nbsp;&amp;nbsp; End date&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp;&amp;nbsp; 1-Nov-16,&amp;nbsp;&amp;nbsp;&amp;nbsp; 31-Jul-17&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,&amp;nbsp;&amp;nbsp;&amp;nbsp; 1-Aug-17,&amp;nbsp;&amp;nbsp;&amp;nbsp; 31-Jul-18&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 13:14:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236578#M855761</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-02-08T13:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate number of months occurring in current year only</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236579#M855762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Sunny.Awesomeness...You are my hero &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 13:21:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236579#M855762</guid>
      <dc:creator>apthansh</dc:creator>
      <dc:date>2017-02-08T13:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate number of months occurring in current year only</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236580#M855763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or just this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;if(Year(Startdate)-Year(Enddate)=0,Month(Enddate)-Month(Startdate),if(Year(Startdate)=Year(Today()),12-Month(Startdate),Month(Enddate)-1)+1) as NoOfMonth;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD ID,date(Date#(Startdate,'DD-MMM-YY'),'DD/MM/YY') as Startdate,date(Date#(Enddate,'DD-MMM-YY'),'DD/MM/YY') as Enddate Inline [&lt;/P&gt;&lt;P&gt;ID,Startdate,Enddate&lt;/P&gt;&lt;P&gt;1,1-Nov-16,31-Jul-17&lt;/P&gt;&lt;P&gt;2,1-Aug-17,31-Jul-18&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 13:25:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-number-of-months-occurring-in-current-year-only/m-p/1236580#M855763</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2017-02-08T13:25:12Z</dc:date>
    </item>
  </channel>
</rss>

