<?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: Set Analysis with Aggr looking beyond current selection in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772502#M274112</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please load your sample apps or sample data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Nov 2014 07:13:30 GMT</pubDate>
    <dc:creator>MK_QSL</dc:creator>
    <dc:date>2014-11-19T07:13:30Z</dc:date>
    <item>
      <title>Set Analysis with Aggr looking beyond current selection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772499#M274109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We're running into a problem using set analysis in conjunction with the aggr() function. Our transaction data set contains the fields [Product], [Month], and [Dollar]. Our goal is to produce a visual that indicates whether a product is "New" or "Old" based on the selected [Month]. If the product does not exist in the selected [Month] but exists in any month after, the product should be labeled "New". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the desired workflow and result:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;- Product A has transactions in July 2013 but not any other month&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;- I select "May 2013"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;- Expression looks in "May 2013", does not find Product A, but finds Product A in July 2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;- Expression classifies Product A as "New"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- Construct a visual with all products labeled as "New" or "Old" with logic above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We've been using a combination of the aggr() function, set analysis, and if conditions to achieve this, but without much success. The main problem, we suspect, has to do with aggregates in set analysis. When we select "May 2013", Qlik seems to only look at the products that exist in the current selection of "May 2013". As a side note, we will have multiple filters, i.e. "Customers" and such. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would someone have an idea how to do this? Attached at the bottom is our expression for this particular table column. We've verified that the inner set analysis works properly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SUM( {$&amp;lt;[Month]= {"&amp;gt;$(=MAX([Month]))"}&amp;gt;} [Dollars] ) &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would the fix have to do with an outer aggregate? If so, how might we implement that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;EM&gt;aggr(&lt;/EM&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;EM&gt;if (&lt;/EM&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;Sum([Dollars]) &amp;lt;= 0 &lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;AND &lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;SUM( {$&amp;lt;[Month]= {"&amp;gt;$(=MAX([Month]))"}&amp;gt;} [Dollars] ) &amp;gt;= 0, 'New',&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;if (&lt;/EM&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;Sum([Dollars]) &amp;gt;= 0&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;AND &lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;SUM( {$&amp;lt;[Month]= {"&amp;gt;$(=MAX([Month]))"}&amp;gt;} [Dollars] ) &amp;lt;= 0, 'Old',&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;Null())),&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;EM&gt;[Product Name])&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 22:30:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772499#M274109</guid>
      <dc:creator />
      <dc:date>2014-11-18T22:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis with Aggr looking beyond current selection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772500#M274110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your Max(Month) is resulting in Numeric Format while your Month may be in MMM format.&lt;/P&gt;&lt;P&gt;Try as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=SubField('$(MonthNames)',';',Max(PDMonth))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE style="border: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;aggr(&lt;/EM&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;if (&lt;/EM&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;Sum([Dollars]) &amp;lt;= 0&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;AND&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;SUM( {$&amp;lt;[Month]= {"&amp;gt;$(=SubField('$(MonthNames)',';',Max(PDMonth)))"}&amp;gt;} [Dollars] ) &amp;gt;= 0, 'New',&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;if (&lt;/EM&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;Sum([Dollars]) &amp;gt;= 0&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;AND&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;SUM( {$&amp;lt;[Month]= {"&amp;gt;$(=SubField('$(MonthNames)',';',Max(PDMonth)))"}&amp;gt;} [Dollars] ) &amp;lt;= 0, 'Old',&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;Null())),&lt;/EM&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-family: inherit;"&gt;[Product Name])&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 22:48:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772500#M274110</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2014-11-18T22:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis with Aggr looking beyond current selection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772501#M274111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply. I don't think this is the case though. Just to clarify, our expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;SUM( {$&amp;lt;[Month]= {"&amp;gt;$(=MAX([Month]))"}&amp;gt;} [Dollars] )&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Is working properly, so I wouldn't think date formatting is our problem here&lt;EM style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 22:57:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772501#M274111</guid>
      <dc:creator />
      <dc:date>2014-11-18T22:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis with Aggr looking beyond current selection</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772502#M274112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please load your sample apps or sample data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 07:13:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-with-Aggr-looking-beyond-current-selection/m-p/772502#M274112</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2014-11-19T07:13:30Z</dc:date>
    </item>
  </channel>
</rss>

