<?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 Variables in set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170551#M503769</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a similar query to this, are you able to use a variable as the value of the set analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count({&amp;lt;[Has Target] = {'Yes'},[SLX Relationship RM Name]-={[RM Selection]}&amp;gt;} DISTINCT [SLX Account ID])&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;In the above RM Selection is my variable would that work?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Oct 2010 11:17:01 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-10-22T11:17:01Z</dc:date>
    <item>
      <title>Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170544#M503762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I use a variable in a set analysis expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Mar 2010 16:24:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170544#M503762</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-05T16:24:48Z</dc:date>
    </item>
    <item>
      <title>Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170545#M503763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just tried this and it seems to work: Sum({$&amp;lt;"$(variable)"={'value'}&amp;gt;} Sales).&lt;BR /&gt;So add double quotes around the variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Mar 2010 17:30:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170545#M503763</guid>
      <dc:creator />
      <dc:date>2010-03-05T17:30:13Z</dc:date>
    </item>
    <item>
      <title>Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170546#M503764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for the reply, actually i am trying to have the variable not in the identifier but in the field value, in your example it will be the Sales&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Mar 2010 19:02:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170546#M503764</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-05T19:02:00Z</dc:date>
    </item>
    <item>
      <title>Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170547#M503765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you want to replace the "expression" (e.g. the Sales) by a variable that holds a definition of your dynamic expression - you can do it, it has nothing to do with the Set Analysis itself - these are two separate parts of the overall aggregation.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;Variable:&lt;/P&gt;&lt;P&gt;vFormula = '(Sales-Cost)'&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;P&gt;sum({Set Analysis Condition } $(vFormula) )&lt;/P&gt;&lt;P&gt;is identical to a "static expression:&lt;/P&gt;&lt;P&gt;sum({Set Analysis Condition } (Sales-Cost) )&lt;/P&gt;&lt;P&gt;I hope this is what you had in mind...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Mar 2010 00:35:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170547#M503765</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2010-03-07T00:35:46Z</dc:date>
    </item>
    <item>
      <title>Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170548#M503766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That exactly what I had in mind, but when I enter my variable, no values are returned, I get nothing just null. I tested my variable and it works if I do not combine it with the set analysis condition.&lt;/P&gt;&lt;P&gt;my example is :&lt;/P&gt;&lt;P&gt;sum&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;({1&amp;lt;OBJECT ={"17*"}&amp;gt;} &lt;B&gt;$(Current_Year_Balance)&lt;/B&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Mar 2010 14:22:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170548#M503766</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-08T14:22:28Z</dc:date>
    </item>
    <item>
      <title>Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170549#M503767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So your variable $(Current_Year_Balance) contains a lot of values, but you only want to summarize the values where OBJECT = '17*' (you should use single quotes here btw. Better for performance). This means there must be a connection between the values in the variable and the values in OBJECT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Mar 2010 16:06:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170549#M503767</guid>
      <dc:creator />
      <dc:date>2010-03-11T16:06:10Z</dc:date>
    </item>
    <item>
      <title>Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170550#M503768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I have a formula that looks like this:&lt;/P&gt;&lt;P&gt;($(vSalesTY) - $(vReturnsTY)) / ($(vNetTransactionsTY))&lt;/P&gt;&lt;P&gt;Can I then add set analysis to the above calculation as follows, to get a result for a set timeperiod?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( {$&amp;lt;FinTxtMonth = {'$(MonthSelected)'} &amp;gt;} (($(vSalesTY) - $(vReturnsTY)) / ($(vNetTransactionsTY))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, how do I use set analysis on the original expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 12:02:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170550#M503768</guid>
      <dc:creator>burgersurfer</dc:creator>
      <dc:date>2010-07-23T12:02:35Z</dc:date>
    </item>
    <item>
      <title>Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170551#M503769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a similar query to this, are you able to use a variable as the value of the set analysis?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count({&amp;lt;[Has Target] = {'Yes'},[SLX Relationship RM Name]-={[RM Selection]}&amp;gt;} DISTINCT [SLX Account ID])&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;In the above RM Selection is my variable would that work?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Oct 2010 11:17:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170551#M503769</guid>
      <dc:creator />
      <dc:date>2010-10-22T11:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170552#M503770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have trouble using a variable in set analysis... &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This works fine (hard coding a date 12 months ago), I get a count of 14:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;count({1&amp;lt;InceptionDate = {"&amp;gt;=07/06/10"}&amp;gt;} PolicyNo)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But as this needs to be a rolling count I set up a variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;v12MonthsStartDate = AddMonths(today(),-12)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Then replaced the date with the variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;count({1&amp;lt;InceptionDate = {"&amp;gt;= v12MonthStartDate"}&amp;gt;} PolicyNo)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but now I get a count of 0...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas why this isn;t working???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jun 2011 10:03:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170552#M503770</guid>
      <dc:creator />
      <dc:date>2011-06-07T10:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170553#M503771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple of things, first up Set Analysis is sensitive to date formats, so I would suggest wrapping your variable assignment in a &lt;STRONG&gt;date &lt;/STRONG&gt;function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;date(AddMonths(today(), -12), 'DD/MM/YY')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also I would recommend using dollar sign expansion in the Set Analysis, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;count({1&amp;lt;InceptionDate = {"&amp;gt;=$(v12MonthStartDate)"}&amp;gt;} PolicyNo)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Personally, I would also set up the variable in the load script (provided your load script runs after midnight on the day you are looking at data) so that you are putting in a fixed rather than a calculated value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;let v12MonthStartDate = &lt;STRONG&gt;date(AddMonths(today(), -12), 'DD/MM/YY');&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way you can check the date in the variable to ensure it is appearing as it is requried in the statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that all makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 17:14:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170553#M503771</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2011-06-28T17:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170554#M503772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oleg (and everyone)-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is wonderfully helpful. That being said, how do I set up set analysis (with variables) to sum up specific values contained in the output of the variables?&amp;nbsp; Here's an example expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;=sum({&amp;lt;Product.ProdName={'$(vProd1)'}&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Product.ProdValue) + sum({&amp;lt;Product.ProdName={'$(vProd2)'}&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Product.ProdValue) + sum({&amp;lt;Product.ProdName={'$(vProd3)'}&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Product.ProdValue) + sum({&amp;lt;Product.ProdName={'$(vProd4)'}&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Product.ProdValue)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above expression works absolutely fine.&amp;nbsp; I need a totals column. That being said, the values contained in vProd1, vProd2, (so on...) contain either a "ProdA" or "ProdB" contained in the ProductName (which is pulled in based on the variable).&amp;nbsp; I need to sum up all values containing "ProdA" and sum up all values containing "ProdB" each in it's own column.&amp;nbsp; What's the best way of accomplishing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also...&amp;nbsp; I have to imagine this can be highly intensive (or could be).&amp;nbsp; I've provided a highly shorted version of this expression above.&amp;nbsp; Additionally, there are always hundreds of Products being added everyday.&amp;nbsp; So, I don't want to run into an "Out of memory" situation.&amp;nbsp; So also looking for efficient ways of handling this situation as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jul 2011 22:06:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variables-in-set-Analysis/m-p/170554#M503772</guid>
      <dc:creator />
      <dc:date>2011-07-18T22:06:04Z</dc:date>
    </item>
  </channel>
</rss>

