<?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 nested in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510265#M190670</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrea,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Glad we are getting closer now!&amp;nbsp; Do you get the right result if you change the total mode from Expression Total to Sum Of Rows?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What dimension do you have on the chart, is that wine type?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you wish to count each client only once in the total - even if that client is counted on multiple rows?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have understood the requirement, it may be that you need to drop the Wine Type out of the Aggr parameters?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Jan 2014 23:33:13 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2014-01-14T23:33:13Z</dc:date>
    <item>
      <title>Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510258#M190663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have the following expression in a straight table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count( {&amp;lt; _FATTURATOFlag = {"S"}, [Anno fattura] = {"$(vAPP)"}, [MMGG fattura] = {"&amp;gt;=$(vMMGGdal)&amp;lt;=$(vMMGGal)"},&lt;/P&gt;&lt;P&gt;[Codice cliente] = {'=sum( {&amp;lt; _FATTURATOFlag = {"S"}, [Anno fattura] = {"$(vAPP)"}, [MMGG fattura] = {"&amp;gt;=$(vMMGGdal)&amp;lt;=$(vMMGGal)"} &amp;gt;} [Importo netto riga] )&amp;gt;0'}&lt;/P&gt;&lt;P&gt;&amp;gt;} DISTINCT [Codice cliente])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with a dimension named "Wine type".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to count the customers ([Codice cliente]) with Sum([Importo netto riga]) &amp;gt; 0 for each dimension value (Wine type).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noted it's working fine only if I select a single dimension value, else I get a number greater than the correct one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somenone help me to achieve it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 17:24:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510258#M190663</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2014-01-14T17:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510259#M190664</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;Could you provide vAPP and vMMGGdal, vMMGGal definition. And describe the relation between Codice cliente and Wine type.&lt;/P&gt;&lt;P&gt;The entire sample would be great.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 18:35:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510259#M190664</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2014-01-14T18:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510260#M190665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ex. vAPP = 2012 (year) ; vMMGGdal = 0101 (as MMDD related to sales date) ; vMMGGal = 1231 (as MMDD related to sales date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;currently we are exploring wine sales for type and [Codice Cliente] is the customer code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 20:38:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510260#M190665</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2014-01-14T20:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510261#M190666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you post a sample application, it will be easier to troubleshoot.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, have you tried to aggregate your count by Wine Type and Client? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aggr(&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;count( {&amp;lt; _FATTURATOFlag = {"S"}, [Anno fattura] = {"$(vAPP)"}, [MMGG fattura] = {"&amp;gt;=$(vMMGGdal)&amp;lt;=$(vMMGGal)"},&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Codice cliente] = {'=sum( {&amp;lt; _FATTURATOFlag = {"S"}, [Anno fattura] = {"$(vAPP)"}, [MMGG fattura] = {"&amp;gt;=$(vMMGGdal)&amp;lt;=$(vMMGGal)"} &amp;gt;} [Importo netto riga] )&amp;gt;0'}&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;gt;} DISTINCT [Codice cliente]), [Wine Type], &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Codice cliente]&lt;/SPAN&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 20:51:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510261#M190666</guid>
      <dc:creator />
      <dc:date>2014-01-14T20:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510262#M190667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are likely to be needing an Aggr statement in there somewhere, to do one aggregation inside another.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Taking the Set Analysis out of the equation, to count Customers with sales over 100K you would have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(aggr(if(sum(Amount) &amp;gt; 100000, 1, 0), Customer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will find plenty written about Aggr elsewhere, but the basic premise of what is going on here is that for every Customer (the second parameter of the Aggr statement) you are doing the nested expression.&amp;nbsp; Each customer will then have a value of either 0 or 1 assigned to it.&amp;nbsp; The sum on the outside then tots up those flags.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to apply Set Analysis to the expression then you can place separate Set Analysis expressions just inside each of the sum functions.&amp;nbsp; If your set analysis is limiting which customers are involved in the expression you will need to repeat the same set analysis.&amp;nbsp; If all customers are included then you probably only need the set analysis in the inner sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another use case for Aggr is if you want to show in a text box an average value by a Field (or group of fields) in a text box (ie. without listing all values).&amp;nbsp; The expression would look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=avg(aggr(sum(Amount), Customer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important thing is that any time you might consider nesting more than one aggregation then the Aggr statement will be your friend.&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;Steve&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Quick Intelligence&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 20:55:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510262#M190667</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2014-01-14T20:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510263#M190668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the expression below:&lt;/P&gt;&lt;P&gt;=sum( {&amp;lt; _FATTURATOFlag = {"S"}, [Anno fattura] = {"$(vAPP)"}, [MMGG fattura] = {"&amp;gt;=$(vMMGGdal)&amp;lt;=$(vMMGGal)"} &amp;gt;}&lt;/P&gt;&lt;P&gt;aggr(if(sum( {&amp;lt; _FATTURATOFlag = {"S"}, [Anno fattura] = {"$(vAPP)"}, [MMGG fattura] = {"&amp;gt;=$(vMMGGdal)&amp;lt;=$(vMMGGal)"} &amp;gt;} [Importo netto riga] )&amp;gt;0, 1, 0), [Codice cliente]) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I have the same wrong result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 21:16:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510263#M190668</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2014-01-14T21:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510264#M190669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Finally, using the below expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum( aggr( if(sum( {&amp;lt; _FATTURATOFlag = {"S"}, [Anno fattura] = {"$(vAPP)"}, [MMGG fattura] = {"&amp;gt;=$(vMMGGdal)&amp;lt;=$(vMMGGal)"} &amp;gt;} [Importo netto riga] )&amp;gt;0, 1, 0),&lt;/P&gt;&lt;P&gt;[Wine type], [Codice cliente]) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I get the correct value for each wine type but the expression total is wrong because it sums all rows value rather than the COUNT DISTINCT [Codice cliente].&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 21:39:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510264#M190669</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2014-01-14T21:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510265#M190670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrea,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Glad we are getting closer now!&amp;nbsp; Do you get the right result if you change the total mode from Expression Total to Sum Of Rows?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What dimension do you have on the chart, is that wine type?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you wish to count each client only once in the total - even if that client is counted on multiple rows?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have understood the requirement, it may be that you need to drop the Wine Type out of the Aggr parameters?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 23:33:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510265#M190670</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2014-01-14T23:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510266#M190671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;No I get the same wrong result using either "Expression Total" or "Sum of Rows" option.&lt;/P&gt;&lt;P&gt;In both cases I get the sum of all rows values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I have the "win type" as dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I have to count customers only once with sales amount &amp;gt; 0 even if that customer is counted on multiple rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll let you know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 09:27:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510266#M190671</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2014-01-15T09:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510267#M190672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could try returning the client code in the aggregation, so that you can count it at both the dimensional and the total level:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;count(DISTINCT aggr( if(sum( {&amp;lt; _FATTURATOFlag = {"S"}, [Anno fattura] = {"$(vAPP)"}, [MMGG fattura] = {"&amp;gt;=$(vMMGGdal)&amp;lt;=$(vMMGGal)"} &amp;gt;} [Importo netto riga] )&amp;gt;0, &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;[Codice cliente]&lt;/SPAN&gt;, null()),&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;[Wine type], [Codice cliente]) )&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 09:44:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510267#M190672</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2014-01-15T09:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis nested</title>
      <link>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510268#M190673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's working well !!!&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jan 2014 10:28:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-analysis-nested/m-p/510268#M190673</guid>
      <dc:creator>agigliotti</dc:creator>
      <dc:date>2014-01-15T10:28:56Z</dc:date>
    </item>
  </channel>
</rss>

