<?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 Reuse Complex Expression in Multiple Objects with Different Parameters in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152220#M29738</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, searching on $1 in the reference manual, I found "Dollar-Sign Expansion with Parameters". It's pretty brief, but at least it's written down &lt;EM&gt;somewhere&lt;/EM&gt;. It IS surprising that QlikView is giving you an error. I was briefly worried that the error meant that even if it still worked, it wasn't officially supported any more. But I figure as long as it's in the 9.0 reference manual, we're safe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Aug 2010 00:02:13 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2010-08-07T00:02:13Z</dc:date>
    <item>
      <title>Reuse Complex Expression in Multiple Objects with Different Parameters</title>
      <link>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152217#M29735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone, I have a complex expression that I'm using throughout my QlikView app in almost all of my objects. The expression changes slightly between each object. I tried putting the expression into a variable, however how do I pass a parameter to a variable? In essence I'm almost creating a function call.&lt;/P&gt;&lt;P&gt;For example, I have a Profit &amp;amp; Loss statement which has 5 expressions. The first expression calculates the value for the current period, next expression is previous period, expression after that is the different, expression after that is the previous year same period, etc, etc.&lt;/P&gt;&lt;P&gt;The expression looks like this:&lt;/P&gt;&lt;P&gt;Current Period:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;num((&lt;/P&gt;&lt;P&gt;if(Measure='Device ASP - CDMA' OR Measure='Device ASP - C2K' OR Measure = 'Device ASP - WCDMA' OR Measure = 'Shares Outstanding',&lt;/P&gt;&lt;P&gt;avg (if(SubmissionQuarter=VersionQtr,Data)),&lt;/P&gt;&lt;P&gt;if(Measure = 'Gross Profit %',&lt;/P&gt;&lt;P&gt;sum(if(AllMeasures='Gross Profit' AND SubmissionQuarter=VersionQtr,Data))/sum(if(AllMeasures='Total Revenue' AND SubmissionQuarter=VersionQtr,Data)),&lt;/P&gt;&lt;P&gt;if(Measure = 'Operating Expenses %',&lt;/P&gt;&lt;P&gt;sum(if(AllMeasures='Operating Expenses' AND SubmissionQuarter=VersionQtr,Data))/sum(if(AllMeasures='Total Revenue' AND SubmissionQuarter=VersionQtr,Data)),&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;it continues&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the next period, all that changes is the statement of SubmissionQuarter = PrevVersionQtr instead of VersionQtr.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Is there a way to create a function and then pass it a parameter or use variables to achieve this somehow?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Aug 2010 22:51:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152217#M29735</guid>
      <dc:creator />
      <dc:date>2010-08-06T22:51:53Z</dc:date>
    </item>
    <item>
      <title>Reuse Complex Expression in Multiple Objects with Different Parameters</title>
      <link>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152218#M29736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attached is an example of creating fake functions using variables and with two parameters each.&lt;/P&gt;&lt;P&gt;Edit: To give a more direct answer, you put a parameter in a variable with $1, $2, etc. So you'd replace VersionQtr with $1 in your variable. Then you should be able to use $(MyFunction(VersionQtr)), $(MyFunction(PrevVersionQtr)), etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Aug 2010 23:41:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152218#M29736</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-08-06T23:41:34Z</dc:date>
    </item>
    <item>
      <title>Reuse Complex Expression in Multiple Objects with Different Parameters</title>
      <link>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152219#M29737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent!! Thanks John, exactly what I was looking for. Odd though that the variable editor doesn't like the syntax when you enter $1, it says error, but the function does indeed work. Probably a bug in QlikView. I'm surprised by this feature, wish it was documented somewhere.&lt;/P&gt;&lt;P&gt;Thanks again!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Aug 2010 23:49:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152219#M29737</guid>
      <dc:creator />
      <dc:date>2010-08-06T23:49:11Z</dc:date>
    </item>
    <item>
      <title>Reuse Complex Expression in Multiple Objects with Different Parameters</title>
      <link>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152220#M29738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, searching on $1 in the reference manual, I found "Dollar-Sign Expansion with Parameters". It's pretty brief, but at least it's written down &lt;EM&gt;somewhere&lt;/EM&gt;. It IS surprising that QlikView is giving you an error. I was briefly worried that the error meant that even if it still worked, it wasn't officially supported any more. But I figure as long as it's in the 9.0 reference manual, we're safe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Aug 2010 00:02:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Reuse-Complex-Expression-in-Multiple-Objects-with-Different/m-p/152220#M29738</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-08-07T00:02:13Z</dc:date>
    </item>
  </channel>
</rss>

