<?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: Variable with parameter in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102049#M457713</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks very much Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Sep 2018 16:21:40 GMT</pubDate>
    <dc:creator>rutger_jansen</dc:creator>
    <dc:date>2018-09-06T16:21:40Z</dc:date>
    <item>
      <title>Variable with parameter</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102045#M457709</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 have several calculations that I want to put into variables and they would need to accept a variable as a parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g., I have a calculation as:&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt; $(vLatestMonth), FLAG = {'Y'} &amp;gt;} AMOUNT_1 ) / SUM ( {&amp;lt; $(vLatestMonth), FLAG = {'Y'} &amp;gt;} AMOUNT_2 )&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt; $(vPrevMonth),&amp;nbsp;&amp;nbsp; FLAG = {'Y'} &amp;gt;} AMOUNT_1 ) / SUM ( {&amp;lt; $(vPrevMonth),&amp;nbsp;&amp;nbsp; FLAG = {'Y'} &amp;gt;} AMOUNT_2 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I want to define&lt;SPAN style="font-size: 10pt;"&gt; a variable for that calculation:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;vMetric(@)= SUM( {&amp;lt; @, FLAG = {'Y'} &amp;gt;} AMOUNT_1 ) / SUM ( {&amp;lt; @,&amp;nbsp;&amp;nbsp; FLAG = {'Y'} &amp;gt;} AMOUNT_2 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then use the variable in a chart by passing in another variable containing some set analysis:&lt;/P&gt;&lt;P&gt;$(vMetric (vLatestMonth) ) / $(&lt;SPAN style="font-size: 13.3333px;"&gt;vMetric( vPrevMonth ) )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If that is possible, what is the correct syntax?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Rutger&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2018 13:40:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102045#M457709</guid>
      <dc:creator>rutger_jansen</dc:creator>
      <dc:date>2018-09-06T13:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Variable with parameter</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102046#M457710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looked quite ok. unless some small syntax-issues and should work if your vLatest/PrevMonth variables contain a valid set analysis statement - and that there is no comma included which is always regarded as a parameter-delimiter. Therefore try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vMetric:&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt; &lt;STRONG&gt;$1&lt;/STRONG&gt;, FLAG = {'Y'} &amp;gt;} AMOUNT_1 ) / SUM ( {&amp;lt; &lt;STRONG&gt;$1&lt;/STRONG&gt;,&amp;nbsp;&amp;nbsp; FLAG = {'Y'} &amp;gt;} AMOUNT_2 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(vMetric (vLatestMonth)) / $(&lt;SPAN style="font-size: 13.3333px;"&gt;vMetric(vPrevMonth))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2018 15:09:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102046#M457710</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2018-09-06T15:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Variable with parameter</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102047#M457711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi rugerm when calling a variable you can pass different parameters, each one spearated by commas:&lt;/P&gt;&lt;P&gt;var(parameter1, parameter2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then $1 is used to get the first parameter, $2 for the second, etc.. So i think that vMetric should be:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;SUM( {&amp;lt; &lt;STRONG&gt;$($1)&lt;/STRONG&gt;, FLAG = {'Y'} &amp;gt;} AMOUNT_1 ) / SUM ( {&amp;lt; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;$($1)&lt;/STRONG&gt;&lt;/SPAN&gt;,&amp;nbsp;&amp;nbsp; FLAG = {'Y'} &amp;gt;} AMOUNT_2 )&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2018 15:36:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102047#M457711</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2018-09-06T15:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Variable with parameter</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102048#M457712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class=""&gt;Hi i am start in this, you can help me ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2018 15:40:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102048#M457712</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-06T15:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Variable with parameter</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102049#M457713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks very much Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2018 16:21:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102049#M457713</guid>
      <dc:creator>rutger_jansen</dc:creator>
      <dc:date>2018-09-06T16:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Variable with parameter</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102050#M457714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ruben, much appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2018 16:22:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102050#M457714</guid>
      <dc:creator>rutger_jansen</dc:creator>
      <dc:date>2018-09-06T16:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Variable with parameter</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102051#M457715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can try, what is your question? Maybe it's better to create a new 'discussion' for the community? Go to your login &amp;gt; Inbox/Activity &amp;gt; Discussion &amp;gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2018 08:46:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-with-parameter/m-p/102051#M457715</guid>
      <dc:creator>rutger_jansen</dc:creator>
      <dc:date>2018-09-07T08:46:18Z</dc:date>
    </item>
  </channel>
</rss>

