<?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: Variables in .txt file brought in script via include statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117546#M368765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if this is the same problem, but I have experienced similar behavior when pulling expressions in from Excel. The problem with Excel is related to hard returns in the individual cells which contain the expression. Only the first line of the expression was coming in and being evaluated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, the following expression is written for easy reading/understanding, and it works fine in a QV object:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Product]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='A', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Product]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='B', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)-&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Taxes&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;However, for the full expression to come into QV from an Excel cell, the returns have to be removed:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Product]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='A', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Product]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='B', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)-&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Taxes&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;f the text wraps automatically, there is no problem. Hope this helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 May 2016 21:39:54 GMT</pubDate>
    <dc:creator>ellenblackwell</dc:creator>
    <dc:date>2016-05-20T21:39:54Z</dc:date>
    <item>
      <title>Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117542#M368761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following script is in an include statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;Set eRevenue = if (([Travel Year]='$(vYearToday)' and&amp;nbsp; [Travel Month]=$(vMaxMonth)),&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ), &lt;/P&gt;&lt;P&gt;if (([Travel Year]='$(vYearToday)'-1 and&amp;nbsp; [Travel Month]=$(vMaxMonth)),&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),&lt;/P&gt;&lt;P&gt;if (([Travel Year]='$(vYearToday)'-2 and&amp;nbsp; [Travel Month]=$(vMaxMonth)),&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"&amp;lt;=$(vMaxMonth)"}&amp;gt;}Revenue ))));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;Can you advise what is the issue in this as it is not working?&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;P&gt;Also, in same file I have script as below which is working in chart:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;Set eRankRevenue = rank(eRevenue);&lt;/DIV&gt;&lt;DIV style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The same script is working in variables in charts.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Nazira&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 19:30:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117542#M368761</guid>
      <dc:creator>naziralala</dc:creator>
      <dc:date>2016-05-20T19:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117543#M368762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Script is running into an error or the expression is not working on the front end?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 19:35:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117543#M368762</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-20T19:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117544#M368763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Need more information as Sunny mentioned... it will help us to identify the issue, Also try &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;eRevenue expressions individually and see if you are getting the expected results and that will give you a clear idea where it is going wrong if any.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 19:40:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117544#M368763</guid>
      <dc:creator>trdandamudi</dc:creator>
      <dc:date>2016-05-20T19:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117545#M368764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The same script is working in the chart...tried individually..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 19:43:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117545#M368764</guid>
      <dc:creator>naziralala</dc:creator>
      <dc:date>2016-05-20T19:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117546#M368765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if this is the same problem, but I have experienced similar behavior when pulling expressions in from Excel. The problem with Excel is related to hard returns in the individual cells which contain the expression. Only the first line of the expression was coming in and being evaluated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, the following expression is written for easy reading/understanding, and it works fine in a QV object:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Product]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='A', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Product]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='B', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)-&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Taxes&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;However, for the full expression to come into QV from an Excel cell, the returns have to be removed:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Product]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='A', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Product]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;='B', &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Sales&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)-&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Taxes&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;))) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;I&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;f the text wraps automatically, there is no problem. Hope this helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 21:39:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117546#M368765</guid>
      <dc:creator>ellenblackwell</dc:creator>
      <dc:date>2016-05-20T21:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117547#M368766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ellen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please explain in more detail?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done in .txt file..how can we do the same in excel..and in&lt;/P&gt;&lt;P&gt;detail..if possible with an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nazira&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 22:07:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117547#M368766</guid>
      <dc:creator>naziralala</dc:creator>
      <dc:date>2016-05-20T22:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117548#M368767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be check this out: &lt;A href="https://community.qlik.com/docs/DOC-5012"&gt;Managing Variables&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2016 23:12:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117548#M368767</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-05-20T23:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117549#M368768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Nazira,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used, and would recommend, the same post that Sunny referred to in his latest response. If your requirement can be met using .txt, however, I would try to resolve the issue within your current process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on the issue, you may just need a 2nd equal sign in your SET statement. Below, I have implemented&amp;nbsp; the 2 suggestions I've made within your expression. Perhaps one of these options will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OPTION 1&lt;/STRONG&gt; - Remove hard returns from the expression in your .txt file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set eRevenue = if (([Travel Year]='$(vYearToday)' and&amp;nbsp; [Travel Month]=$(vMaxMonth)), sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ), if (([Travel Year]='$(vYearToday)'-1 and&amp;nbsp; [Travel Month]=$(vMaxMonth)),sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),if (([Travel Year]='$(vYearToday)'-2 and&amp;nbsp; [Travel Month]=$(vMaxMonth)), sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ), sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"&amp;lt;=$(vMaxMonth)"}&amp;gt;}Revenue ))));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OPTION 2&lt;/STRONG&gt; - Add an '=' sign to the expression, so that it is evaluated when you bring it in&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set eRevenue = =if (([Travel Year]='$(vYearToday)' and&amp;nbsp; [Travel Month]=$(vMaxMonth)),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ), &lt;/P&gt;&lt;P&gt;if (([Travel Year]='$(vYearToday)'-1 and&amp;nbsp; [Travel Month]=$(vMaxMonth)),&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),&lt;/P&gt;&lt;P&gt;if (([Travel Year]='$(vYearToday)'-2 and&amp;nbsp; [Travel Month]=$(vMaxMonth)),&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Travel Year]={$(vMaxYear)},[Travel Month]={"&amp;lt;=$(vMaxMonth)"}&amp;gt;}Revenue ))));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know if one of these work!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 May 2016 00:21:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117549#M368768</guid>
      <dc:creator>ellenblackwell</dc:creator>
      <dc:date>2016-05-21T00:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117550#M368769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ellen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The post recommended by Sunny works except in case as below:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 469px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl63" height="237" width="144"&gt;ePYRevenue&lt;/TD&gt;&lt;TD class="xl64" width="325"&gt;'=if (([Travel Year]='$(vYearToday)' and&amp;nbsp; [Travel Month]=$(vMaxMonth)),&lt;BR /&gt; sum({&amp;lt;[Travel Year]={$(vPreviousYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ), &lt;BR /&gt; if (([Travel Year]='$(vYearToday)'-1 and [Travel Month]=$(vMaxMonth)),&lt;BR /&gt; sum({&amp;lt;[Travel Year]={$(vPreviousYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),&lt;BR /&gt; if (([Travel Year]='$(vYearToday)'-2 and [Travel Month]=$(vMaxMonth)),&lt;BR /&gt; sum({&amp;lt;[Travel Year]={$(vPreviousYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),&lt;BR /&gt; sum({&amp;lt;[Travel Year]={$(vPreviousYear)},[Travel Month]={"&amp;lt;=$(vMaxMonth)"}&amp;gt;}Revenue ))))&lt;BR /&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Please advise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nazira&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jun 2016 20:58:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117550#M368769</guid>
      <dc:creator>naziralala</dc:creator>
      <dc:date>2016-06-05T20:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117551#M368770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;The post recommended by you works except in case as below:&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="border: 0px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl63" height="237" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="144"&gt;ePYRevenue&lt;/TD&gt;&lt;TD class="xl64" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="325"&gt;'=if (([Travel Year]='$(vYearToday)' and&amp;nbsp; [Travel Month]=$(vMaxMonth)),&lt;BR /&gt;sum({&amp;lt;[Travel Year]={$(vPreviousYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ), &lt;BR /&gt;if (([Travel Year]='$(vYearToday)'-1 and [Travel Month]=$(vMaxMonth)),&lt;BR /&gt;sum({&amp;lt;[Travel Year]={$(vPreviousYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),&lt;BR /&gt;if (([Travel Year]='$(vYearToday)'-2 and [Travel Month]=$(vMaxMonth)),&lt;BR /&gt;sum({&amp;lt;[Travel Year]={$(vPreviousYear)},[Travel Month]={"=$(vMaxMonth)"}&amp;gt;}Revenue ),&lt;BR /&gt;sum({&amp;lt;[Travel Year]={$(vPreviousYear)},[Travel Month]={"&amp;lt;=$(vMaxMonth)"}&amp;gt;}Revenue ))))&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;Please advise.&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;Nazira&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jun 2016 20:59:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117551#M368770</guid>
      <dc:creator>naziralala</dc:creator>
      <dc:date>2016-06-05T20:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117552#M368771</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 think your expression doesn't work because of the nested single quotes that cannot be easily resolved. Generally speaking, you can either use the function REPLACE() to replace single quotes by another symbol and then replace the other symbol back to single quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your particular case, however, it seems like you should simply remove the first single quote, right after the equals sign, and the rest should be OK. I'm not looking into the validity of the expression logic and into the performance aspects of it (your expression can be simplified and improved substantially).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In broader terms, you could avoid some of these problems if you stored your expressions externally in a text file and loaded them into your load script, generating the corresponding variables in the process of the load. That helps avoiding issues caused by nested quotes, $-sign expansions etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm describing this technique, along with many other advanced techniques, in my book &lt;A href="http://www.amazon.com/gp/product/1118949552/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1118949552&amp;amp;linkCode=as2&amp;amp;tag=natursyner0f-20&amp;amp;linkId=IN55M5EPRHLRBWIQ"&gt;QlikView Your Business&lt;/A&gt; - check it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jun 2016 21:14:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117552#M368771</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2016-06-05T21:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117553#M368772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Oleg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using an excel file. When I take the single quotes off, it gives me an error.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;Please advise.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jun 2016 21:43:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117553#M368772</guid>
      <dc:creator>naziralala</dc:creator>
      <dc:date>2016-06-05T21:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117554#M368773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you post your excel file containing the variable definition and the script you are using to read the variables in?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jun 2016 22:07:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117554#M368773</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-06-05T22:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in .txt file brought in script via include statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117555#M368774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For starters, replace your Excel file with a text file - CSV, for example. Excel files are inconvenient for two reasons:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, these are not text files, so you can't easily compare two files and find differences using an advanced text editor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second, they apply their own quoting and distort your formulas - exactly what's happening to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You won't have this problem with a regular text file, not managed in Excel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jun 2016 22:09:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-txt-file-brought-in-script-via-include-statement/m-p/1117555#M368774</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2016-06-05T22:09:03Z</dc:date>
    </item>
  </channel>
</rss>

