<?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 Variable in a formula throws error in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-in-a-formula-throws-error/m-p/94851#M757873</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Variable to get Jan of the selected Year. It works.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15361220128566583" jivemacro_uid="_15361220128566583"&gt;
&lt;P&gt;vTimeFloor=Date(makedate(Year,1),'MMM YY')&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I have an expression to return Jan of the previous year. It works.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15361219996929862" jivemacro_uid="_15361219996929862"&gt;
&lt;P&gt;=date(addyears(Date(makedate(Year,1),'MMM YY'),-1),'MMM YY')&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I put the Variable into the formula but it throws error that a ')' is expected&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15361220061028292 jive_text_macro" jivemacro_uid="_15361220061028292"&gt;
&lt;P&gt;=date(addyears($(vTimeFloor),-1),'MMM YY')&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/212665_error.PNG" style="height: 56px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please help show me what formatting did I do wrong? This is very small issue but it costs me lots of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Variable in a formula throws error</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-a-formula-throws-error/m-p/94851#M757873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Variable to get Jan of the selected Year. It works.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15361220128566583" jivemacro_uid="_15361220128566583"&gt;
&lt;P&gt;vTimeFloor=Date(makedate(Year,1),'MMM YY')&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I have an expression to return Jan of the previous year. It works.&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15361219996929862" jivemacro_uid="_15361219996929862"&gt;
&lt;P&gt;=date(addyears(Date(makedate(Year,1),'MMM YY'),-1),'MMM YY')&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I put the Variable into the formula but it throws error that a ')' is expected&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15361220061028292 jive_text_macro" jivemacro_uid="_15361220061028292"&gt;
&lt;P&gt;=date(addyears($(vTimeFloor),-1),'MMM YY')&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/212665_error.PNG" style="height: 56px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please help show me what formatting did I do wrong? This is very small issue but it costs me lots of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&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/Variable-in-a-formula-throws-error/m-p/94851#M757873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in a formula throws error</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-a-formula-throws-error/m-p/94852#M757874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Angie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Try,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=date(addyears(vTimeFloor,-1),'MMM YY') &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Sep 2018 04:42:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-a-formula-throws-error/m-p/94852#M757874</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2018-09-05T04:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in a formula throws error</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-a-formula-throws-error/m-p/94853#M757875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;When there is no selection in Year field or multiple years are in the scope, your expression might not work. Try re-defining your variable , like&lt;/SPAN&gt;&lt;SPAN style="color: #333333;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;vTimeFloor=&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; color: #006699; background-color: inherit; font-size: 9pt !important;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;(makedate(&lt;STRONG style="color: #ff0000;"&gt;Max&lt;/STRONG&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 9pt !important; background-color: inherit; font-weight: inherit;"&gt;Year)&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;,1)&lt;SPAN style="color: #000000;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit; color: blue; background-color: inherit; font-size: 9pt !important;"&gt;&lt;SPAN style="color: #000000;"&gt;'MMM YY&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; background-color: inherit; font-size: 9pt !important;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-style: inherit; font-size: 10pt; background-color: inherit; font-weight: inherit;"&gt;And then, remove '$' sign when you are calling the function in the expression, like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-family: 'courier new', courier; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit; font-weight: inherit;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="keyword" style="font-size: 12px; color: #006699;"&gt;date&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; color: #000000;"&gt;(addyears(vTimeFloor,-1),&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;'MMM YY'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12px; font-family: 'courier new', courier;"&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 12px; background-color: inherit; font-family: 'courier new', courier; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-style: inherit; font-size: 10pt; background-color: inherit; font-family: arial, helvetica, sans-serif; font-weight: inherit;"&gt;Note: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-style: inherit; font-size: 12px; background-color: inherit; font-family: 'courier new', courier; font-weight: inherit;"&gt;&lt;SPAN style="color: #333333; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;'$' removal would not be required, if you remove the '=' sign from variable definition. I.e. either remove '=' from variable definition or '$' from variable calling in expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Sep 2018 05:15:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-a-formula-throws-error/m-p/94853#M757875</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2018-09-05T05:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in a formula throws error</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-a-formula-throws-error/m-p/94854#M757876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I have a Variable to get Jan of the selected Year. It works.&lt;/P&gt;&lt;P class="dp-highlighter" style="color: #3d3d3d;"&gt;&lt;/P&gt;&lt;DIV class="bar" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;OL class="dp-sql" start="1" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;vTimeFloor=&lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;(makedate(&lt;/SPAN&gt;&lt;SPAN class="func" style="font-weight: inherit; font-style: inherit; color: #ff1493;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;,1),&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit;"&gt;'MMM YY'&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;try&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL class="dp-sql" start="1" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;vTimeFloor=&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;Date(makedate(max(Year,1)),'MMM YY') &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Then I have an expression to return Jan of the previous year. It works.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="bar" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;DIV style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;OL class="dp-sql" start="1" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit;"&gt;date&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;(addyears(&lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;(makedate(&lt;/SPAN&gt;&lt;SPAN class="func" style="font-weight: inherit; font-style: inherit; color: #ff1493;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;,1),&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit;"&gt;'MMM YY'&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;),-1),&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit;"&gt;'MMM YY'&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;try&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL class="dp-sql" start="1" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;=date(addyears(Date(makedate(max(Year,1)),'MMM YY'),-1),'MMM YY') &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN class="dp-highlighter" style="color: #3d3d3d;"&gt;&lt;SPAN class="dp-highlighter" style="color: #3d3d3d;"&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;I put the Variable into the formula but it throws error that a ')' is expected&lt;/SPAN&gt;&lt;SPAN class="dp-highlighter" style="color: #3d3d3d;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="bar" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;DIV style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;OL class="dp-sql" start="1" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit;"&gt;date&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;(addyears($(vTimeFloor),-1),&lt;/SPAN&gt;&lt;SPAN class="string" style="font-weight: inherit; font-style: inherit;"&gt;'MMM YY'&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;try&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL class="dp-sql" start="1" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;=date(addyears($(vTimeFloor),-1),'MMM YY') &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Sep 2018 05:42:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-a-formula-throws-error/m-p/94854#M757876</guid>
      <dc:creator>ChennaiahNallani</dc:creator>
      <dc:date>2018-09-05T05:42:14Z</dc:date>
    </item>
  </channel>
</rss>

