<?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 Using Variables for Expressions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-Variables-for-Expressions/m-p/1576212#M597633</link>
    <description>&lt;P&gt;Stuck on this one for some time today, hoping some more brains can help figure it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For ease of example I have two variables:&lt;/P&gt;&lt;P&gt;"vFormula_1001" which looks like: Sum({&amp;lt;DateFilter,[GL Account Group]={'A*'}&amp;gt;} ActValue)&lt;/P&gt;&lt;P&gt;and "vFormula_1002" which &lt;SPAN&gt;looks like: Sum({&amp;lt;DateFilter,[GL Account Group]={'B*'}&amp;gt;} ActValue)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then have a table chart with 1 Dimension: ValueList('Row1','Row2'), and 12 columns: "Fiscal Month 1", "Fiscal Month 2" … etc. through "Fiscal Month 12".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is replace the "DateFilter" text portion of the variables with "FiscalMonth={'01'}", 02 … etc. through 12 and evaluate the resulting string as my expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my chart expression for Fiscal Month 1 is: pick(RowNo(),Replace(vFormula_1001, 'DateFilter,', 'FiscYear={'&amp;amp;Chr(39)&amp;amp;'01'&amp;amp;Chr(39)&amp;amp;'}'),&lt;SPAN&gt;Replace(vFormula_1002, 'DateFilter,', 'FiscYear={'&amp;amp;Chr(39)&amp;amp;'01'&amp;amp;Chr(39)&amp;amp;'}')).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In this form the expression evaluates perfectly, displaying as a string. However as soon as I put a $() or $(=) around each pick option I get no results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Reason I am doing this is to build some financial reports and I don't want to have to duplicate by 12 each line as a variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2019 04:22:26 GMT</pubDate>
    <dc:creator>NZ_QV_Guy</dc:creator>
    <dc:date>2019-05-03T04:22:26Z</dc:date>
    <item>
      <title>Using Variables for Expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Variables-for-Expressions/m-p/1576212#M597633</link>
      <description>&lt;P&gt;Stuck on this one for some time today, hoping some more brains can help figure it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For ease of example I have two variables:&lt;/P&gt;&lt;P&gt;"vFormula_1001" which looks like: Sum({&amp;lt;DateFilter,[GL Account Group]={'A*'}&amp;gt;} ActValue)&lt;/P&gt;&lt;P&gt;and "vFormula_1002" which &lt;SPAN&gt;looks like: Sum({&amp;lt;DateFilter,[GL Account Group]={'B*'}&amp;gt;} ActValue)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then have a table chart with 1 Dimension: ValueList('Row1','Row2'), and 12 columns: "Fiscal Month 1", "Fiscal Month 2" … etc. through "Fiscal Month 12".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is replace the "DateFilter" text portion of the variables with "FiscalMonth={'01'}", 02 … etc. through 12 and evaluate the resulting string as my expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my chart expression for Fiscal Month 1 is: pick(RowNo(),Replace(vFormula_1001, 'DateFilter,', 'FiscYear={'&amp;amp;Chr(39)&amp;amp;'01'&amp;amp;Chr(39)&amp;amp;'}'),&lt;SPAN&gt;Replace(vFormula_1002, 'DateFilter,', 'FiscYear={'&amp;amp;Chr(39)&amp;amp;'01'&amp;amp;Chr(39)&amp;amp;'}')).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In this form the expression evaluates perfectly, displaying as a string. However as soon as I put a $() or $(=) around each pick option I get no results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Reason I am doing this is to build some financial reports and I don't want to have to duplicate by 12 each line as a variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 04:22:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Variables-for-Expressions/m-p/1576212#M597633</guid>
      <dc:creator>NZ_QV_Guy</dc:creator>
      <dc:date>2019-05-03T04:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using Variables for Expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Variables-for-Expressions/m-p/1576259#M597634</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;You only need two new parametriced variables. Please, check the attached file.&lt;/P&gt;&lt;P&gt;Bests,&lt;/P&gt;&lt;P&gt;Jaime.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 07:25:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Variables-for-Expressions/m-p/1576259#M597634</guid>
      <dc:creator>jaibau1993</dc:creator>
      <dc:date>2019-05-03T07:25:40Z</dc:date>
    </item>
  </channel>
</rss>

