<?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 set analysis with a variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171350#M885878</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Sep 2016 13:18:52 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-09-09T13:18:52Z</dc:date>
    <item>
      <title>How to use set analysis with a variable</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171345#M885873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a variable defined as vAHT = sum(TotalTime)/Sum(TotalCalls).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to show this variable over a 12 months period (past 12) and I have a set expression like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;CalPeriod={"&amp;gt;$(=Max(CalPeriod)-12) &amp;lt;=$(=Max(CalPeriod))"},Year=,Month=,Day=&amp;gt;}TotalTime)/&lt;/P&gt;&lt;P&gt;sum({&amp;lt;CalPeriod={"&amp;gt;$(=Max(CalPeriod)-12) &amp;lt;=$(=Max(CalPeriod))"},Year=,Month=,Day=&amp;gt;}TotalCalls)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to change it use the variable only - something like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;CalPeriod={"&amp;gt;$(=Max(CalPeriod)-12) &amp;lt;=$(=Max(CalPeriod))"},Year=,Month=,Day=&amp;gt;}$(vAHT)) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I am not getting the correct answer - can anyone help or advise what I am doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171345#M885873</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use set analysis with a variable</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171346#M885874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think that it is not possible to use nested aggregation besides using aggr().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&amp;gt; basically after vAHT was replaced by "sum(TotalTime)/Sum(TotalCalls)"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your formula looks like that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( .... sum(TotalTime)/Sum(TotalCalls))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2016 18:54:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171346#M885874</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-08T18:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use set analysis with a variable</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171347#M885875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like Robin mentioned you creates a nested aggregation which is without the use of aggr() not valid. Your variable would be need to extend to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vAHT = aggr(sum(TotalTime)/Sum(TotalCalls), Dim1, Dim2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whereby that meant that you would use an aggr-function where it won't really needed and should be therefore better avoided then it adds unnecessary complexity and decreased the performance (especially in your case you would need to determine which conditions belong the inner- and which to the outer-aggregation).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More practically to simplify the expressions might be to put the condition within an variable, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vAHT = {&amp;lt;CalPeriod={"&amp;gt;$(=Max(CalPeriod)-12) &amp;lt;=$(=Max(CalPeriod))"},Year=,Month=,Day=&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then as expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum($(vAHT) TotalTime) / sum($(vAHT) TotalCalls)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or the use of parametrized variables, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vAHT = {&amp;lt;CalPeriod={"&amp;gt;$(=Max(&lt;STRONG&gt;$1&lt;/STRONG&gt;)-&lt;STRONG&gt;$2&lt;/STRONG&gt;) &amp;lt;=$(=Max(&lt;STRONG&gt;$1&lt;/STRONG&gt;))"},Year=,Month=,Day=&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then as expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum($(vAHT(CalPeriod, 12)) TotalTime) / sum($(vAHT(CalPeriod, 12)) TotalCalls)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More to the use of variables could you find here: &lt;A href="https://community.qlik.com/docs/DOC-14559"&gt;Variables&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 08:26:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171347#M885875</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-09-09T08:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use set analysis with a variable</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171348#M885876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amit,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In your expression:&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;sum({&amp;lt;CalPeriod={"&amp;gt;$(=Max(CalPeriod)-12) &amp;lt;=$(=Max(CalPeriod))"},Year=,Month=,Day=&amp;gt;}$(vAHT))&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;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; font-size: 13px;"&gt;you're summing an average which doesn't really make sense. It's best to work out an average, which will be the ratio of two quantities, at the final stage of a calculation.&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;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; font-size: 13px;"&gt;Kind regards&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;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; font-size: 13px;"&gt;Andrew&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 09:17:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171348#M885876</guid>
      <dc:creator>effinty2112</dc:creator>
      <dc:date>2016-09-09T09:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use set analysis with a variable</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171349#M885877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Amit,&lt;/P&gt;&lt;P&gt;Use your variable as function:&lt;/P&gt;&lt;P&gt;Your variable: sum($1 TotalTime)/Sum( $1 TotalCalls)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(YourVar({&amp;lt;CalPeriod={"&amp;gt;$(=Max(CalPeriod)-12) &amp;lt;=$(=Max(CalPeriod))"},Year=,Month=,Day=&amp;gt;}))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 09:42:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171349#M885877</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-09T09:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use set analysis with a variable</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171350#M885878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 13:18:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-set-analysis-with-a-variable/m-p/1171350#M885878</guid>
      <dc:creator />
      <dc:date>2016-09-09T13:18:52Z</dc:date>
    </item>
  </channel>
</rss>

