<?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: How to use variable in set analysis ? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750783#M471508</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The $() around the variable forces the variable to be evaluated&lt;/P&gt;&lt;P&gt;$(= expression) forces the expression to be evaluated.&lt;/P&gt;&lt;P&gt;It may be a bit belt-and-braces but it does work.&lt;/P&gt;&lt;P&gt;I always type variables within $() as it seems to work consistently, whereas just typing the variable name does not always evaluate correctly&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Mar 2015 14:25:38 GMT</pubDate>
    <dc:creator>Colin-Albert</dc:creator>
    <dc:date>2015-03-05T14:25:38Z</dc:date>
    <item>
      <title>How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750775#M471500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my application, there are data for several years and I would like to show in a graph only the last 3 years (current one + 2 laters).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I created a variable : vCurrentYear = max(MyYear)&amp;nbsp;&amp;nbsp;&amp;nbsp; // MyYear is a field in my calendar that goes until the date of execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I put =$(vCurrentYear)&amp;nbsp; in a textbox, I do get 2015.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my graph, in the expression tab, I have entered&amp;nbsp; in order to get the sum of Cpt_abt for the past 3 years. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Year_S={"&amp;gt;=$(vCurrentYear)-2"}&amp;gt;}Cpt_abt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I get the message "No data to display".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If instead, I put &lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Year_S={"&amp;gt;=2013"}&amp;gt;}Cpt_abt)&amp;nbsp;&amp;nbsp; , I do get my graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am guessing there must be something wrong with the quotations marks but I cannot find the proper way to write my expression.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:06:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750775#M471500</guid>
      <dc:creator />
      <dc:date>2015-03-05T14:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750776#M471501</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;try an alternative way of building your set_analysis, a little less elegant, but more robust - and the script_editor knows that.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt; sum({&amp;lt;Year_S = {"$(= '&amp;gt;=' &amp;amp; vCurrentYear)"}&amp;gt;} &amp;lt;&amp;lt;&lt;/P&gt;&lt;P&gt;You might need to put that variable vCurrentYear into another $() - I don't know for sure - but I guess not as you can only do this on the GUI anyway and vCurrentYear is a numeric value which usually doesn't require that.&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:12:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750776#M471501</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-03-05T14:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750777#M471502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would try this and see if this work (I can't try it since I don't have any application opened)&lt;/P&gt;&lt;P&gt;&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;&lt;STRONG&gt;sum({$&amp;lt;Year_S={'&amp;gt;=$(=$(vCurrentYear)-2)'}&amp;gt;}Cpt_abt)&lt;/STRONG&gt;&lt;/SPAN&gt;&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;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&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;Have never tried 2 $ signs before, but may work. But if it doesn't then I would suggest another variable for Year-2, may be vPrevYear2 = Max(Year) - 2 and use that in your modifier as follows:&lt;/SPAN&gt;&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;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&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;&lt;STRONG&gt;&lt;STRONG style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum({$&amp;lt;Year_S={'&amp;gt;=$(vPrevYear2)'}&amp;gt;}Cpt_abt)&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&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;HTH&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:12:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750777#M471502</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-03-05T14:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750778#M471503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Year_S={"&amp;gt;=$(=$(vCurrentYear)-2)"}&amp;gt;}Cpt_abt)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:13:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750778#M471503</guid>
      <dc:creator>chrislofthouse</dc:creator>
      <dc:date>2015-03-05T14:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750779#M471504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sum({$&amp;lt;Year_S={"&amp;gt;=$(=vCurrentYear-2)"}&amp;gt;}Cpt_abt)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:15:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750779#M471504</guid>
      <dc:creator>luciancotea</dc:creator>
      <dc:date>2015-03-05T14:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750780#M471505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To apply the calculation in the set expression you need to enclose the calculation within $(= )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Year_S={"&amp;gt;=$(= $(vCurrentYear) -2 )"}&amp;gt;}Cpt_abt)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:19:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750780#M471505</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2015-03-05T14:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750781#M471506</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;Define &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vCurrentYear&lt;/SPAN&gt; to evaluate globally. That means the definition should have an = sign in front:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =max(MyYear)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Now in the text box, you should be able to enter &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;vCurrentYear&lt;/SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;end get the year. Then use this expression (note the = sign)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({$&amp;lt;Year_S = {"&amp;gt;=$(=vCurrentYear - 2)"}&amp;gt;} Cpt_abt)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;HTH&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Jonathan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:20:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750781#M471506</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-03-05T14:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750782#M471507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So &lt;STRONG style="font-size: 11.6999998092651px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;A href="https://community.qlik.com/people/Colin_Albert"&gt;Colin_Albert&lt;/A&gt; &lt;/STRONG&gt;, double $'s do work in the modifier? Never tried them before, but I was curious.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:21:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750782#M471507</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-03-05T14:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750783#M471508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The $() around the variable forces the variable to be evaluated&lt;/P&gt;&lt;P&gt;$(= expression) forces the expression to be evaluated.&lt;/P&gt;&lt;P&gt;It may be a bit belt-and-braces but it does work.&lt;/P&gt;&lt;P&gt;I always type variables within $() as it seems to work consistently, whereas just typing the variable name does not always evaluate correctly&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:25:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750783#M471508</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2015-03-05T14:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750784#M471509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great, its good to know that it does work. I will probably try to find its use somewhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:27:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750784#M471509</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-03-05T14:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750785#M471510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works ! Thank you !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I would like to understand what does the equal sign do ? What does "evaluate globally" mean ? I I don't put the equal sign, it is "locally" evaluated ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:29:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750785#M471510</guid>
      <dc:creator />
      <dc:date>2015-03-05T14:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750786#M471511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2014/11/24/the-equal-sign"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2014/11/24/the-equal-sign&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:36:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750786#M471511</guid>
      <dc:creator>luciancotea</dc:creator>
      <dc:date>2015-03-05T14:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use variable in set analysis ?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750787#M471512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Without the = sign, you are inserting the expression and the expression is evaluated after expansion. That's why you use =$(var) in the text box. The expression is expanded and then evaluated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the = sign, the variable is evaluated continuously and the value itself is inserted. Now you can use &lt;/P&gt;&lt;P&gt;=var in the text box, because var has already been calculated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Mar 2015 14:38:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-variable-in-set-analysis/m-p/750787#M471512</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-03-05T14:38:34Z</dc:date>
    </item>
  </channel>
</rss>

