<?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 Problem in reusing expressions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324755#M119637</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guy, Celambarasan and Jagan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I forgot to mention that the expression should be in single quote. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;='sum(Sales)' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;='Sum({&amp;lt;PricingModel={"CPC"}&amp;gt;} cost)'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sajeevan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Feb 2012 11:01:23 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-02-28T11:01:23Z</dc:date>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324746#M119628</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;In order to re-use expression (so i can use it in different charts without typing the expression again), i use LET in the script, and then the $() in the chart.&lt;/P&gt;&lt;P&gt;Nevertheless, when there is a &lt;SPAN style="color: #ff0000;"&gt;string &lt;/SPAN&gt;comparison in the expression (see below the PricingModel=&lt;SPAN style="color: #ff0000;"&gt;CPC) &lt;SPAN style="color: #000000;"&gt;the expression is not valid.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vRevenue = 'Sum(if(PricingModel=&lt;SPAN style="color: #ff0000;"&gt;CPC&lt;/SPAN&gt;,cost))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i cause this expression to be valid?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to clear it up, when i use the expression Sum(if(PricingModel=&lt;SPAN style="color: #333333;"&gt;'CPC'&lt;/SPAN&gt;,cost)) &lt;STRONG&gt;directly &lt;/STRONG&gt;in the chart it is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Guy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 09:24:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324746#M119628</guid>
      <dc:creator />
      <dc:date>2012-02-28T09:24:14Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324747#M119629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; You approach is correct.but let is like assigning value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vRevenue has the value Sum(if(PricingModel=&lt;SPAN style="color: #ff0000;"&gt;CPC&lt;/SPAN&gt;,cost)) here CPC is as string so it should be enclosed in quotes in your case it takes as a variable or fieldname.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Use Set Instead of Let&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Check with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;SET vRevenue = Sum(if(PricingModel='&lt;SPAN style="color: #ff0000;"&gt;CPC'&lt;/SPAN&gt;,cost));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Now use &lt;STRONG&gt;$(vRevenue)&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Celambarasan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 09:33:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324747#M119629</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-02-28T09:33:00Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324748#M119630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use the variables for such re-usage of expressions. Go to Settings/Variable Overview then click the add button to add a new variable with name as vRevenue, click the newly added variable and set the definition as =Sum(if(PricingModel=&lt;SPAN style="color: #ff0000;"&gt;CPC&lt;/SPAN&gt;,cost)) then use this variabe in expressions as =$(vRevenue).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Sajeevan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 09:36:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324748#M119630</guid>
      <dc:creator />
      <dc:date>2012-02-28T09:36:55Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324749#M119631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, It works! The idea is indeed using SET instead of LET when defining the expression in the script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 09:56:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324749#M119631</guid>
      <dc:creator />
      <dc:date>2012-02-28T09:56:25Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324750#M119632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sajeevan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That will not work, because if i use the expression in the Varaible Overview then it is evaluated immediatly,&lt;/P&gt;&lt;P&gt;so the value remains the same for all rows in the chart (when using ithis expression in a chart.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks anyway,&lt;/P&gt;&lt;P&gt;Guy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 10:04:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324750#M119632</guid>
      <dc:creator />
      <dc:date>2012-02-28T10:04:49Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324751#M119633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; You can use the approach suggested by &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/sajeevan" id="jive-335818856069090881982" onmouseout="" onmouseover="" style="font-size: 12px; color: #007fc0; font-weight: bold;"&gt;Sajeevan Govindan&lt;/A&gt; but without the equal sign.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Defining there with '=' sign is like Let without equal sign is like Set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; like this&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Sum(if(PricingModel='&lt;SPAN style="font-size: 12px; color: #ff0000;"&gt;CPC'&lt;/SPAN&gt;,cost))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Celambarasan&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 10:14:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324751#M119633</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-02-28T10:14:51Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324752#M119634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I never had issues even if I use "=" sign. I use it regularly. Some time I load all my expression from an excel file and use it assigning to a variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 10:31:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324752#M119634</guid>
      <dc:creator />
      <dc:date>2012-02-28T10:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324753#M119635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you use = sign then its like predefined calculation like storing the calculated value to the variable not expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Check by this approach&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Have year and month dimension in chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Store vSales variable value as =Sum(Sales).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Check by adding Expression to the chart as $(vSales) it will give same value for all dimension values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Celambarasan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 10:36:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324753#M119635</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-02-28T10:36:58Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324754#M119636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sanjeevan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you assign '=' for an expression it precalculates, it is like static calculation, all the rows in chart has same value.&lt;/P&gt;&lt;P&gt;If you didn't use '=' for an expression it is dynamic, it calculates dynamically in the chart, all the rows in the chart will have corresponding value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the difference between the two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 10:43:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324754#M119636</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-02-28T10:43:28Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324755#M119637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guy, Celambarasan and Jagan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I forgot to mention that the expression should be in single quote. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;='sum(Sales)' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;='Sum({&amp;lt;PricingModel={"CPC"}&amp;gt;} cost)'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sajeevan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 11:01:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324755#M119637</guid>
      <dc:creator />
      <dc:date>2012-02-28T11:01:23Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324756#M119638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sajeevan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Yes now it will work.Its like assigning a string value to a variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Celambarasan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 11:15:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324756#M119638</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2012-02-28T11:15:24Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324757#M119639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hו &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" href="https://community.qlik.com/people/sajeevan" id="jive-335818863719633084207" style="background-color: #f9f9f9; font-size: 12px; color: #007fc0; font-weight: bold; font-family: Arial; text-align: center;"&gt;Sajeevan Govindan&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the expression &lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #ffffff;"&gt;='Sum({&amp;lt;PricingModel={"CPC"}&amp;gt;} cost)' &lt;/SPAN&gt; works &lt;SPAN style="background-color: #ffffff; color: #636363; font-family: Arial; font-size: 12px;"&gt;becuase you use SET ANALYSIS in the expression, otherwise is not. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #636363; font-family: Arial; font-size: 12px;"&gt;Thanks a lot for all opf you!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 12:43:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324757#M119639</guid>
      <dc:creator />
      <dc:date>2012-02-28T12:43:21Z</dc:date>
    </item>
    <item>
      <title>Problem in reusing expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324758#M119640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Yes, you are right.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 12:53:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-in-reusing-expressions/m-p/324758#M119640</guid>
      <dc:creator />
      <dc:date>2012-02-28T12:53:27Z</dc:date>
    </item>
  </channel>
</rss>

