<?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 Evaluate &amp;quot;parameter minus 1&amp;quot; when parsing a variable in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Evaluate-quot-parameter-minus-1-quot-when-parsing-a-variable/m-p/1551483#M39754</link>
    <description>&lt;P&gt;Hi all, I am having a heck of a time getting one of my variables to properly evaluate.&amp;nbsp; I thought I had it figured out, but I'm stumped.&lt;/P&gt;&lt;P&gt;I defined a common set expression which would take a commodity type (Gas or ELectric), and then calculate the total volume of the commodity for the year.&lt;/P&gt;&lt;P&gt;These are defined in my load script:&lt;/P&gt;&lt;P&gt;SET v_VolumeSetExpression = "Service={$1},Concept={'Stores'}, Volume={'&amp;gt;=0'}";&lt;BR /&gt;SET v_VolumeForYear = "sum({&amp;lt;$(v_VolumeSetExpression($1)), Year={$2},[Volume UOM]={$3}&amp;gt;} Volume*[Volume Factor])";&lt;/P&gt;&lt;P&gt;This works great, and if I call them from a KPI or Table widget with the expression&amp;nbsp;&lt;/P&gt;&lt;P&gt;=$(v_VolumeForYear('Gas', 2017)) (or any other year), it works as expected.&lt;/P&gt;&lt;P&gt;Now, I'm also trying to calculate the change year-over-year.&lt;/P&gt;&lt;P&gt;I thought that this expression would work:&lt;/P&gt;&lt;P&gt;SET v_VolumeEvolution = "($(v_VolumeForYear($1, $2, 'kWh'))) / ($(v_VolumeForYear($1, $2-1), 'kWh')))";&lt;/P&gt;&lt;P&gt;With the expectation I could also call this the same way&lt;/P&gt;&lt;P&gt;=$(v_VolumeEvolution('Gas', 2017)&lt;/P&gt;&lt;P&gt;I've tried all sorts of combinations and really thought my latest version would work:&lt;/P&gt;&lt;P&gt;SET v_VolumeEvolution = "($(v_VolumeForYear($1, $2, 'kWh'))) / ($(v_VolumeForYear($1, Num#($2)-1, 'kWh')))";&lt;/P&gt;&lt;P&gt;In this case, though, the variable editor shows the "Num#(" phrase repeated 10,000 (actually that number) times in the expanded expression.&amp;nbsp; CLearly there's some sort of recursion going on but I'm absolutely stumped.&lt;/P&gt;&lt;P&gt;Can anyone help?&amp;nbsp; I've been plugging away for literally hours and could use an expert pair of eyes on this.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Mar 2019 00:46:53 GMT</pubDate>
    <dc:creator>shope99</dc:creator>
    <dc:date>2019-03-04T00:46:53Z</dc:date>
    <item>
      <title>Evaluate "parameter minus 1" when parsing a variable</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-quot-parameter-minus-1-quot-when-parsing-a-variable/m-p/1551483#M39754</link>
      <description>&lt;P&gt;Hi all, I am having a heck of a time getting one of my variables to properly evaluate.&amp;nbsp; I thought I had it figured out, but I'm stumped.&lt;/P&gt;&lt;P&gt;I defined a common set expression which would take a commodity type (Gas or ELectric), and then calculate the total volume of the commodity for the year.&lt;/P&gt;&lt;P&gt;These are defined in my load script:&lt;/P&gt;&lt;P&gt;SET v_VolumeSetExpression = "Service={$1},Concept={'Stores'}, Volume={'&amp;gt;=0'}";&lt;BR /&gt;SET v_VolumeForYear = "sum({&amp;lt;$(v_VolumeSetExpression($1)), Year={$2},[Volume UOM]={$3}&amp;gt;} Volume*[Volume Factor])";&lt;/P&gt;&lt;P&gt;This works great, and if I call them from a KPI or Table widget with the expression&amp;nbsp;&lt;/P&gt;&lt;P&gt;=$(v_VolumeForYear('Gas', 2017)) (or any other year), it works as expected.&lt;/P&gt;&lt;P&gt;Now, I'm also trying to calculate the change year-over-year.&lt;/P&gt;&lt;P&gt;I thought that this expression would work:&lt;/P&gt;&lt;P&gt;SET v_VolumeEvolution = "($(v_VolumeForYear($1, $2, 'kWh'))) / ($(v_VolumeForYear($1, $2-1), 'kWh')))";&lt;/P&gt;&lt;P&gt;With the expectation I could also call this the same way&lt;/P&gt;&lt;P&gt;=$(v_VolumeEvolution('Gas', 2017)&lt;/P&gt;&lt;P&gt;I've tried all sorts of combinations and really thought my latest version would work:&lt;/P&gt;&lt;P&gt;SET v_VolumeEvolution = "($(v_VolumeForYear($1, $2, 'kWh'))) / ($(v_VolumeForYear($1, Num#($2)-1, 'kWh')))";&lt;/P&gt;&lt;P&gt;In this case, though, the variable editor shows the "Num#(" phrase repeated 10,000 (actually that number) times in the expanded expression.&amp;nbsp; CLearly there's some sort of recursion going on but I'm absolutely stumped.&lt;/P&gt;&lt;P&gt;Can anyone help?&amp;nbsp; I've been plugging away for literally hours and could use an expert pair of eyes on this.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 00:46:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-quot-parameter-minus-1-quot-when-parsing-a-variable/m-p/1551483#M39754</guid>
      <dc:creator>shope99</dc:creator>
      <dc:date>2019-03-04T00:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluate "parameter minus 1" when parsing a variable</title>
      <link>https://community.qlik.com/t5/App-Development/Evaluate-quot-parameter-minus-1-quot-when-parsing-a-variable/m-p/1556758#M40461</link>
      <description>&lt;P&gt;If possible, can you please post a screenshot of the resulting expression or maybe a sample file that exhibits the behavior?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 18:09:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Evaluate-quot-parameter-minus-1-quot-when-parsing-a-variable/m-p/1556758#M40461</guid>
      <dc:creator>Jamie_Gregory</dc:creator>
      <dc:date>2019-03-14T18:09:22Z</dc:date>
    </item>
  </channel>
</rss>

