<?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 Using AGGR in set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294964#M109455</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect that you need to be ignoring more fields in the Set Analysis statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you try replacing the first $ with the digit 1 (ie. ignore selections) does it give data for the the correct year? This is not a solution - just something to analyze the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Define fields to ignore from the selection by listing them with just an equals after, eg. &lt;STRONG&gt;Date=,MonthYear=,&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That statement will fail if you have more than one possible Fiscal Year, suggest that you put a Max around it before taking off the minus 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You probably want to specify the max month as well - but make sure you get the max month in the max year - not just the max month (which could well be December the previous year).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I always find that creating variables for working out max date values and prior date values makes things much easier.&amp;nbsp; I've uploaded a Shared QlikView that gives an example of how this can be done:&lt;A _jive_internal="true" href="https://community.qlik.com/qlikviews/http://community.qlik.com/qlikviews/1113"&gt;http://community.qlik.com/qlikviews/1113&lt;/A&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally,I would try putting the Set Analysis inside the SUM within the AGGR - not sure if it will make any difference - but it feels more correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.quickintelligence.co.uk/"&gt;Steve&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Aug 2011 21:42:57 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2011-08-23T21:42:57Z</dc:date>
    <item>
      <title>Using AGGR in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294963#M109454</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;I am having an issue with a statement in a chart.&amp;nbsp; My goal is to return the sum of [Entry Amt] by distinct [Entry No] for the Current Fiscal Year -1.&amp;nbsp; My statement below is currently returning a zero value When my current selection is 2011, June.&amp;nbsp; It should be returning the summed value for 2010, June.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum ({$&amp;lt;[Fiscal Year]={$(=([Fiscal Year]-1))},[Trans Mode]={'AIR COLLECT'}&amp;gt;}AGGR(SUM(DISTINCT [Entry Amt]), [Entry No])) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a seperate chart, I am doing the same thing but for the currently selected fiscal year, and it is returning properly.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any advice would be greatly appreciated, thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 20:02:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294963#M109454</guid>
      <dc:creator />
      <dc:date>2011-08-23T20:02:01Z</dc:date>
    </item>
    <item>
      <title>Using AGGR in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294964#M109455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect that you need to be ignoring more fields in the Set Analysis statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you try replacing the first $ with the digit 1 (ie. ignore selections) does it give data for the the correct year? This is not a solution - just something to analyze the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Define fields to ignore from the selection by listing them with just an equals after, eg. &lt;STRONG&gt;Date=,MonthYear=,&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That statement will fail if you have more than one possible Fiscal Year, suggest that you put a Max around it before taking off the minus 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You probably want to specify the max month as well - but make sure you get the max month in the max year - not just the max month (which could well be December the previous year).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I always find that creating variables for working out max date values and prior date values makes things much easier.&amp;nbsp; I've uploaded a Shared QlikView that gives an example of how this can be done:&lt;A _jive_internal="true" href="https://community.qlik.com/qlikviews/http://community.qlik.com/qlikviews/1113"&gt;http://community.qlik.com/qlikviews/1113&lt;/A&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally,I would try putting the Set Analysis inside the SUM within the AGGR - not sure if it will make any difference - but it feels more correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.quickintelligence.co.uk/"&gt;Steve&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 21:42:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294964#M109455</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2011-08-23T21:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using AGGR in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294965#M109456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Steve, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am able to successfully return the value I am looking for on current year -1 if I remove the AGGR from the statement.&amp;nbsp; So for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;sum({$&amp;lt;[Fiscal Year]={$(=([Fiscal Year]-1))},[Trans Mode]={'AIR COLLECT'}&amp;gt;}[Entry Amt])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This will return an amount for current year - 1 properly, but does not return the correct value.&amp;nbsp; The AGGR is necessary for data purposes and works when it is current fiscal year, but will not when used with the set analysis of fiscal year -1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I breaking a rule in my set analysis with the AGGR in the expression?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 17:29:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294965#M109456</guid>
      <dc:creator />
      <dc:date>2011-08-24T17:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using AGGR in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294966#M109457</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;&lt;/P&gt;&lt;P&gt;AGGR(sum ({$&amp;lt;[Fiscal Year]={$(=([Fiscal Year]-1))},[Trans Mode]={'AIR COLLECT'}&amp;gt;} DISTINCT [Entry Amt]), [Entry No])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 20:20:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294966#M109457</guid>
      <dc:creator />
      <dc:date>2011-08-24T20:20:29Z</dc:date>
    </item>
    <item>
      <title>Using AGGR in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294967#M109458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to place the Aggr around the Sum that works for you - rather than just around the [Entry Amt] field.&amp;nbsp; I don't believe the DISTINCT statement will be neccesary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you will wind up with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=sum(Aggr(&lt;/STRONG&gt;sum({$&amp;lt;[Fiscal Year]={$(=([Fiscal Year]-1))},[Trans Mode]={'AIR COLLECT'}&amp;gt;}[Entry Amt])&lt;STRONG&gt;, [Entry No]))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not dissimilar with what you started with, just in a slightly different order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 21:44:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-AGGR-in-set-analysis/m-p/294967#M109458</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2011-08-24T21:44:15Z</dc:date>
    </item>
  </channel>
</rss>

