<?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 Aggr Variable Calc - Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggr-Variable-Calc-Set-Analysis/m-p/1099810#M365038</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am struggling to use a aggregated calculation in a variable with set analysis. If someone could please try and assist I would appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scenario:&lt;/P&gt;&lt;P&gt;Customers gets assigned a RebateLevel(1,2 or 3) depending on monthly average sales (This is done in a variable as follows...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;vRebateLevelCalc&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;gt;4000,if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;lt;9999,'1'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; ,if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;gt;10000,if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;lt;19999,'2'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; ,if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;gt;20000,'3','4')))))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Now, in a straight table I want to list the customers, and by using set analysis I want to calculate the (sales * rebate%) where [Cust Rebate Level] = vRebateLevelCalc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This is my expression:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;sum({&amp;lt;RebateLevel={'$(=$(vRebateLevelCalc))'},RebateDivision={'Division1'}, RebateIndicator = {1}&amp;gt;} INCOME*RebatePercentage)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This seems to work, but only when I have ONE customer selected. If I want to display all customers it calculates ZERO. Furthermore, If I add the vRebateLevelCalc alone as another expression, it does seem to calculate per customer. But for some reason it doesnt calculate the above expression for multiple customers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Does anyone have an idea of what I can do to overcome this problem?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;Wynand.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Aug 2016 09:11:14 GMT</pubDate>
    <dc:creator>wcilliers</dc:creator>
    <dc:date>2016-08-12T09:11:14Z</dc:date>
    <item>
      <title>Aggr Variable Calc - Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Variable-Calc-Set-Analysis/m-p/1099810#M365038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am struggling to use a aggregated calculation in a variable with set analysis. If someone could please try and assist I would appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scenario:&lt;/P&gt;&lt;P&gt;Customers gets assigned a RebateLevel(1,2 or 3) depending on monthly average sales (This is done in a variable as follows...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;vRebateLevelCalc&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;gt;4000,if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;lt;9999,'1'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; ,if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;gt;10000,if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;lt;19999,'2'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; ,if(aggr(sum({&amp;lt;Fisc.Year = {$(Max Year)},RebateDivision={'Division1'}&amp;gt;}Total &amp;lt;Customer&amp;gt;&amp;nbsp; INCOME) / Count ({&amp;lt;Fisc.Year = {$(Max Year)}&amp;gt;}TOTAL DISTINCT Fisc.Month),Customer) &amp;gt;20000,'3','4')))))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Now, in a straight table I want to list the customers, and by using set analysis I want to calculate the (sales * rebate%) where [Cust Rebate Level] = vRebateLevelCalc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This is my expression:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;sum({&amp;lt;RebateLevel={'$(=$(vRebateLevelCalc))'},RebateDivision={'Division1'}, RebateIndicator = {1}&amp;gt;} INCOME*RebatePercentage)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This seems to work, but only when I have ONE customer selected. If I want to display all customers it calculates ZERO. Furthermore, If I add the vRebateLevelCalc alone as another expression, it does seem to calculate per customer. But for some reason it doesnt calculate the above expression for multiple customers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Does anyone have an idea of what I can do to overcome this problem?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;Wynand.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 09:11:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Variable-Calc-Set-Analysis/m-p/1099810#M365038</guid>
      <dc:creator>wcilliers</dc:creator>
      <dc:date>2016-08-12T09:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr Variable Calc - Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Variable-Calc-Set-Analysis/m-p/1099811#M365039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The set is calculated at the chart level, not at the row (i.e. customer) level. I think you'll have to remove from &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10.6667px;"&gt;RebateLevel={'$(=$(vRebateLevelCalc))'}&lt;/SPAN&gt; the set modifier and use an if statement instead:&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: 10.6667px;"&gt;sum({&amp;lt;RebateDivision={'Division1'}, RebateIndicator = {1}&amp;gt;} If(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10.6667px;"&gt;RebateLevel=$(vRebateLevelCalc),&lt;/SPAN&gt; INCOME*RebatePercentage))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 09:44:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Variable-Calc-Set-Analysis/m-p/1099811#M365039</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-08-12T09:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr Variable Calc - Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Aggr-Variable-Calc-Set-Analysis/m-p/1099812#M365040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Gysbert, will give it a try.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Aug 2016 10:04:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggr-Variable-Calc-Set-Analysis/m-p/1099812#M365040</guid>
      <dc:creator>wcilliers</dc:creator>
      <dc:date>2016-08-12T10:04:08Z</dc:date>
    </item>
  </channel>
</rss>

