<?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 Error in expression: AddYears takes 2 parameters in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749314#M267356</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;hello everybody. below the message i get while loading (generic field names for privacy):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Error in expression: AddYears takes 2 parameters &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Concatenate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;AddYears (DATE, 1) as DATE,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NET_SALES_1, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;GROSS_SALES_1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;PIECES_1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;["EXCEL ORIGIN"]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Where &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DATE &amp;lt;= AddYears(, -1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;in the latest &lt;STRONG&gt;AddYears&lt;/STRONG&gt;, just above, on the script I put &lt;STRONG style="color: #808080;"&gt;&lt;EM&gt;$(=max(DATE)) &lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Mar 2015 11:05:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-03-05T11:05:38Z</dc:date>
    <item>
      <title>Error in expression: AddYears takes 2 parameters</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749314#M267356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;hello everybody. below the message i get while loading (generic field names for privacy):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Error in expression: AddYears takes 2 parameters &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Concatenate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;AddYears (DATE, 1) as DATE,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NET_SALES_1, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;GROSS_SALES_1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;PIECES_1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;["EXCEL ORIGIN"]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Where &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DATE &amp;lt;= AddYears(, -1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;in the latest &lt;STRONG&gt;AddYears&lt;/STRONG&gt;, just above, on the script I put &lt;STRONG style="color: #808080;"&gt;&lt;EM&gt;$(=max(DATE)) &lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 11:05:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749314#M267356</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-05T11:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Error in expression: AddYears takes 2 parameters</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749315#M267357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;please attach the snippet where you are assigning the value to the variable.&lt;/P&gt;&lt;P&gt;S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 11:09:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749315#M267357</guid>
      <dc:creator>simospa</dc:creator>
      <dc:date>2015-03-05T11:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error in expression: AddYears takes 2 parameters</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749316#M267358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, you can't use &lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="color: #808080;"&gt;&lt;EM&gt;$(=max(DATE)) &lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;in script like in an expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One way to get that is:&lt;/P&gt;&lt;P&gt;- first load your dates using order by to get the max date in the first row:&lt;/P&gt;&lt;P&gt;Dates_tmp:&lt;/P&gt;&lt;P&gt;LOAD DATE as DATE_tmp&lt;/P&gt;&lt;P&gt;FROM.... order by DATE desc;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- assign that row value to a variable:&lt;/P&gt;&lt;P&gt;LET vMaxDate = Peek('DATE_tmp', 0, 'Dates_tmp');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-then you can use that variable in the where clause:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DATE &amp;lt;= AddYears('&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="color: #808080;"&gt;&lt;EM&gt;$(vMaxDate)' &lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;, -1)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 11:16:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749316#M267358</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2015-03-05T11:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error in expression: AddYears takes 2 parameters</title>
      <link>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749317#M267359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SET ThousandSep='.';&lt;/P&gt;&lt;P&gt;SET DecimalSep=',';&lt;/P&gt;&lt;P&gt;SET MoneyThousandSep='.';&lt;/P&gt;&lt;P&gt;SET MoneyDecimalSep=',';&lt;/P&gt;&lt;P&gt;SET MoneyFormat='€ #.##0,00;-€ #.##0,00';&lt;/P&gt;&lt;P&gt;SET TimeFormat='h.mm.ss';&lt;/P&gt;&lt;P&gt;SET DateFormat='DD/MM/YYYY';&lt;/P&gt;&lt;P&gt;SET TimestampFormat='DD/MM/YYYY h.mm.ss[.fff]';&lt;/P&gt;&lt;P&gt;SET MonthNames='gen;feb;mar;apr;mag;giu;lug;ago;set;ott;nov;dic';&lt;/P&gt;&lt;P&gt;SET DayNames='lun;mar;mer;gio;ven;sab;dom';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TransactionTable:&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;&lt;/P&gt;&lt;P&gt;ID, &lt;/P&gt;&lt;P&gt;SHOP, &lt;/P&gt;&lt;P&gt;DATE,&lt;/P&gt;&lt;P&gt;NET_SALES,&lt;/P&gt;&lt;P&gt;GROSS_SALES, &lt;/P&gt;&lt;P&gt;PIECES&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[EXCEL];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Concatenate&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;&lt;/P&gt;&lt;P&gt;AddYears (DATE, 1) as DATE,&lt;/P&gt;&lt;P&gt;NET_SALES_1, &lt;/P&gt;&lt;P&gt;GROSS_SALES_1,&lt;/P&gt;&lt;P&gt;PIECES_1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[EXCEL]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATE &amp;lt;= AddYears($(=max(DATE)), -1); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataTable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load distinct &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATE,&lt;/P&gt;&lt;P&gt;month(DATE) as MONTH,&lt;/P&gt;&lt;P&gt;year(DATE) as YEAR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resident TransactionTable;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABOVE MY COMPLETE LOAD SCRIPT, I JUST WANTED TO RECREATE &lt;A href="http://stackoverflow.com/questions/25055731/qlikview-past-year-data-calculations"&gt;THIS CENARY&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 11:35:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Error-in-expression-AddYears-takes-2-parameters/m-p/749317#M267359</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-05T11:35:46Z</dc:date>
    </item>
  </channel>
</rss>

