<?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: get Year from date variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37579#M605998</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;pl close this thread by marking a correct answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Apr 2018 19:23:45 GMT</pubDate>
    <dc:creator>sasiparupudi1</dc:creator>
    <dc:date>2018-04-17T19:23:45Z</dc:date>
    <item>
      <title>get Year from date variable</title>
      <link>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37577#M605996</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 the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Load Max(OrderDate) as MaxOrderDate Resident ORDER_2_CUST_SHIPPER;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let currDate=Date(FieldValue('MaxOrderDate',1),'DD-MMM-YYYY');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let currYear=Year($(currDate));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Drop Table Temp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I debug currYear is &amp;lt;NULL&amp;gt;.&lt;BR /&gt;I have also tried &lt;STRONG style="font-size: 13.3333px;"&gt;Let currYear=Year('$(currDate)'); &lt;/STRONG&gt;but I get the same result.&lt;BR /&gt;If I try something like &lt;STRONG style="font-size: 13.3333px;"&gt;Let currYear=Year(Date(FieldValue('MaxOrderDate',1),'DD-MMM-YYYY')); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;then I get the correct value, but this solution is not very dry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Apr 2018 17:20:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37577#M605996</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-15T17:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: get Year from date variable</title>
      <link>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37578#M605997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured it out &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Way that it worked is:&lt;/P&gt;&lt;P&gt;Let currYear=Year(currDate);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, I still do not understand completely how usage of $ works in QlikView, and it is strange, to say the least &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;BR /&gt;In this case, $ did not work for Year function. In same script I had&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Let prevYearDate = MakeDate(Year(&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Date(FieldValue('MaxOrderDate',1),'DD-MMM-YYYY')&lt;/STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - 1,$(currMonth),$(currDay));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and it was working correctly. So, in Year function $ did not work and in MakeDate it did work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My assumption was that no $ is used in script, and $ is used when calling script variables in expressions, but this MakeDate function working properly and Year not, is confusing.&lt;BR /&gt;So, if anyone has any idea why is it so please share &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 07:53:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37578#M605997</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-17T07:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: get Year from date variable</title>
      <link>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37579#M605998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;pl close this thread by marking a correct answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 19:23:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37579#M605998</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2018-04-17T19:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: get Year from date variable</title>
      <link>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37580#M605999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I mark it as answered then no one will bother to explain to me passing of variables to Year and MakeDate and why $ works in one and not another function.&lt;BR /&gt;I will wait for few days and then mark it as answered if no one bothers to answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2018 19:41:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/get-Year-from-date-variable/m-p/37580#M605999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-17T19:41:24Z</dc:date>
    </item>
  </channel>
</rss>

