<?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 evaluate variable in set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240999#M91450</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doing that way makes the expression return null.&lt;/P&gt;&lt;P&gt;The only way I can get a result is writing: sum( if( varX = $(=max(varQ) ) ) ) but that evaluates for the whole table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Oct 2010 08:09:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-10-21T08:09:42Z</dc:date>
    <item>
      <title>evaluate variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240994#M91445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a pivit table where&lt;/P&gt;&lt;P&gt;the expression is:&lt;/P&gt;&lt;P&gt;sum( {$&amp;lt;varX = {$(=calc)}&amp;gt;} xyz )&lt;/P&gt;&lt;P&gt;calc:&lt;/P&gt;&lt;P&gt;max( varQ)&lt;/P&gt;&lt;P&gt;problem :&lt;/P&gt;&lt;P&gt;{$(=calc)} evaluates to {max( varQ)} and no value.&lt;/P&gt;&lt;P&gt;if i make calc with an equalsign : =max( varQ) there is a value but its onyl calculated once = the same for all rows in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what to do?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Oct 2010 10:54:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240994#M91445</guid>
      <dc:creator />
      <dc:date>2010-10-19T10:54:40Z</dc:date>
    </item>
    <item>
      <title>evaluate variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240995#M91446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A set is ALWAYS only calculated once for all rows in the table. So while the dollar sign expansion has the same effect, even if you fixed that part of it, I believe like this...&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum({&amp;lt;varX={$(=$(calc))}&amp;gt;} xyz)&lt;/P&gt;&lt;P&gt;...it wouldn't change the results, because the max(varQ) will STILL be calculated for the entire table instead of that row since it is used in set analysis. So I suspect you're going to need to abandon set analysis and do what you want with a sum(if()), which IS sensitive to the row it is on, as long as you stick with max(varQ) as the value for calc instead of =max(varQ). So I think you need this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;sum(if(varX=$(calc),xyz))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 01:14:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240995#M91446</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-10-20T01:14:31Z</dc:date>
    </item>
    <item>
      <title>evaluate variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240996#M91447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well then sum(if(varX=$(calc),xyz)) will just turn into sum(if(varX= max(varQ) ,xyz)) so the max(varQ) is not calculated..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 13:32:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240996#M91447</guid>
      <dc:creator />
      <dc:date>2010-10-20T13:32:42Z</dc:date>
    </item>
    <item>
      <title>evaluate variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240997#M91448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm not sure about this, but you can try to change calc with max($(varQ)) , I'm guessing varQ is another variable, so maybe this can help&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 15:25:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240997#M91448</guid>
      <dc:creator />
      <dc:date>2010-10-20T15:25:40Z</dc:date>
    </item>
    <item>
      <title>evaluate variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240998#M91449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;calthabis wrote:well then sum(if(varX=$(calc),xyz)) will just turn into sum(if(varX= max(varQ) ,xyz)) so the max(varQ) is not calculated..&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You're half right. It &lt;EM&gt;will&lt;/EM&gt; turn it into sum(if(varX=max(varQ),xyz)). Then it will calculate it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 16:48:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240998#M91449</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-10-20T16:48:44Z</dc:date>
    </item>
    <item>
      <title>evaluate variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240999#M91450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doing that way makes the expression return null.&lt;/P&gt;&lt;P&gt;The only way I can get a result is writing: sum( if( varX = $(=max(varQ) ) ) ) but that evaluates for the whole table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Oct 2010 08:09:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/240999#M91450</guid>
      <dc:creator />
      <dc:date>2010-10-21T08:09:42Z</dc:date>
    </item>
    <item>
      <title>evaluate variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/241000#M91451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;calthabis wrote:Doing that way makes the expression return null.&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Ah, so it does.&lt;/P&gt;&lt;P&gt;Variables &lt;EM&gt;do&lt;/EM&gt; get calculated after replacement, though, so &lt;EM&gt;that's&lt;/EM&gt; not the problem. It appears that the problem is that max(varQ) is meaningless given where it is in the expression. The if() is processing row by row through your source table. So inside of the if(), there's no aggregation occurring, so aggregation functions probably don't work and return null.&lt;/P&gt;&lt;P&gt;So the trick is getting it to not aggregate varX, but to aggregate varQ by your dimensions. One solution is to use sum(aggr(if())), where you aggregate by the dimensions plus a row ID, then use max(total &amp;lt;your dimensions here&amp;gt; varQ) to ignore the row ID again, but only for the aggregation function. So if your pivot table dimension is field "something", and you have a unique row ID of "ID", you could do this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;calc: max(total &amp;lt;something&amp;gt; varQ)&lt;BR /&gt;dimension: something&lt;BR /&gt;expression: sum(aggr(if(varX=max(total &amp;lt;something&amp;gt; varQ),xyz),something,ID))&lt;/P&gt;&lt;P&gt;See attached example. I think it's doing what you're asking for. Not sure how easily it is applied to your real application, though. And there's probably a simpler expression that would do the same thing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Oct 2010 19:41:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/evaluate-variable-in-set-analysis/m-p/241000#M91451</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-10-26T19:41:26Z</dc:date>
    </item>
  </channel>
</rss>

