<?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 How to combine Set Analysis and Aggr functions? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160783#M504389</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;Hello people.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;I'd like to know if I'm trying to do something impossible in QlikView because it didn't work.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;I want to select just the current (or other) month and year in my calendar. Once that the current month and year are selected I need to sum the sales from the current period and compare it with the same month but one year before. In other words what I want is to compare sales from Nov/2009 with Nov/2008.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;The biggest problem here is not to get the values. It's how to combine Set Analysis and Aggr functions to show them by selecting only one month and year.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;I know that I can get the correct values that I need by making a sum in the script, like I did in the attached file. But I have a bigger problem to solve with the same idea and it would be harder to solve it in the script. I'm sending an example to clarify my idea.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;Thanks in advance.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;Huberto P. Haidemann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Nov 2009 19:42:20 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-11-20T19:42:20Z</dc:date>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160783#M504389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;Hello people.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;I'd like to know if I'm trying to do something impossible in QlikView because it didn't work.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;I want to select just the current (or other) month and year in my calendar. Once that the current month and year are selected I need to sum the sales from the current period and compare it with the same month but one year before. In other words what I want is to compare sales from Nov/2009 with Nov/2008.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;The biggest problem here is not to get the values. It's how to combine Set Analysis and Aggr functions to show them by selecting only one month and year.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;I know that I can get the correct values that I need by making a sum in the script, like I did in the attached file. But I have a bigger problem to solve with the same idea and it would be harder to solve it in the script. I'm sending an example to clarify my idea.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;Thanks in advance.&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;Huberto P. Haidemann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2009 19:42:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160783#M504389</guid>
      <dc:creator />
      <dc:date>2009-11-20T19:42:20Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160784#M504390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Huberto,&lt;/P&gt;&lt;P&gt;Could my modification works for you?&lt;/P&gt;&lt;P&gt;Check out it and let me know your experience.&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2009 20:20:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160784#M504390</guid>
      <dc:creator />
      <dc:date>2009-11-20T20:20:05Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160785#M504391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Hi Miguel.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;First of all, thanks. Your suggest works fine and I'm going to use it in my application.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;To tell the truth, now I don't remember why I used that expression. But there was a mistake in the results. &lt;IMG alt="Indifferent" src="http://community.qlik.com/emoticons/emotion-8.gif" /&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Another way to improve your solution is this, without variables:&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR style="margin:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt;sum ( {$&amp;lt;Ano = {&lt;B&gt;&lt;I&gt;$(=max(Ano) - 1)&lt;/I&gt;&lt;/B&gt;}&amp;gt;} [Valor Liquido Mercadoria] / [Valor Cotacao Dolar Exportacao])&lt;BR style="margin:0cm 0cm 0pt;" /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;But I'd like to know if you could keep that structure and show me the same values. Or if it's not possible, could you try to explain me the reason why it didn't work?&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Thanks.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Huberto.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2009 22:27:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160785#M504391</guid>
      <dc:creator />
      <dc:date>2009-11-20T22:27:29Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160786#M504392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Humberto,&lt;/P&gt;&lt;P&gt;First at all, you're wellcome.&lt;/P&gt;&lt;P&gt;About your doubt, I don't understand what do you wanna say with "if you could keep that structure and show me the same values", could you be a little bit more specific?&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Nov 2009 15:55:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160786#M504392</guid>
      <dc:creator />
      <dc:date>2009-11-23T15:55:25Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160787#M504393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;Hi Miguel.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;Sure, I will try to explain better why I need to keep that structure.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;I have another application where I combine both functions, Set Analysis and Aggr. Your suggestion was excellent. It solved my problem but if I solve this problem in the current example I will be able to solve the problem in the other application. I guess.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;This is the expression that I have in the other application:&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt;count(&lt;BR style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt; aggr ( {$&amp;lt;Ano={"*"}, Mes={"*"}, Dia={"*"}&amp;gt; *&lt;BR style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt; 1&amp;lt;Periodo = {"&amp;gt;=$(#=date(addmonths(makedate(max(Ano), max(Mes), 1), -2), 'MMM-YYYY')) &amp;lt;=$(#=date(makedate(max(Ano), max(Mes), 1), 'MMM-YYYY'))"}&amp;gt;}&lt;BR style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt; if (count (distinct if ([Pedido Liberado] = 1, Pedido)) -&lt;BR style="MARGIN:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt; count (distinct if ([Pedido Liberado] = 0, Pedido)) &amp;gt; 0, Periodo), LinkRepresentante, LinkLinha, Periodo))&lt;BR style="MARGIN:0cm 0cm 0pt;" /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;In my opinion, the expression above is a little bit complex to explain briefly. So I'd like to solve that problem using a simple example.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;If you didn't understand something that I wrote, please, let me know.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;Thanks a lot Miguel.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;Huberto.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Nov 2009 00:01:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160787#M504393</guid>
      <dc:creator />
      <dc:date>2009-11-24T00:01:41Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160788#M504394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Hi Miguel.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;I wonder if you have any news for me.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Thanks.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Huberto.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Nov 2009 03:59:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160788#M504394</guid>
      <dc:creator />
      <dc:date>2009-11-27T03:59:54Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160789#M504395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Humberto,&lt;/P&gt;&lt;P&gt;Sorry by my absence, I've been moving house, so I wasn't looking my email.&lt;/P&gt;&lt;P&gt;I've tried reproduce your case but I don't understand what is it's structure, so If you could send me a little example with data maybe I could help you.&lt;/P&gt;&lt;P&gt;I wonder about data in the field Periodo, it's format is MMM-YYYY? because your condition is based in &amp;gt;= Date('date', 'MMM-YYYY') and it's returning the shortname of the month concatenated with the number of year, ¿is this a correct comparison?. I mean, ¿Periodo is a date field as well?.&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Dec 2009 14:55:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160789#M504395</guid>
      <dc:creator />
      <dc:date>2009-12-03T14:55:29Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160790#M504396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;Hi.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;I'm sorry, Miguel. When I said "But I'd like to know if you could keep that structure and show me the same values." I mean if you could keep the original expression. The expression you can see in the file that was attached in the first post.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;About the field Periodo you are right. The field contains a date with the format "MMM-YYYY".&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;The expression works fine when I don't use the function &lt;I style="mso-bidi-font-style:normal;"&gt;aggr&lt;/I&gt;. But, when I combine &lt;I style="mso-bidi-font-style:normal;"&gt;Set&lt;/I&gt; &lt;I style="mso-bidi-font-style:normal;"&gt;Analysis&lt;/I&gt; with &lt;I style="mso-bidi-font-style:normal;"&gt;aggr&lt;/I&gt; the data are showed only if I select the months.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;What I need is to select just one month and one year and get the same values that I have when I select the months. In this example, there are three months to be selected.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;I was talking to some friends here in Brazil and they told me that it doesn't work. But I'm not sure about that…&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;Thanks again.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;Huberto.&lt;/P&gt;&lt;P style="MARGIN:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2009 17:13:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160790#M504396</guid>
      <dc:creator />
      <dc:date>2009-12-09T17:13:07Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160791#M504397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Huberto,&lt;/P&gt;&lt;P&gt;I'm not understand why you want keep the original expression, because I found two reasons, the first one is the sentence is wrong, the intersection is wrong formulated and the second one you are doing an aggregation by a field named LinkNF and afterwards the graphic applies 3 fields dimensions.&lt;/P&gt;&lt;P&gt;So, I don't know what really do you want, but I understand do you wanna get a value independent the months selected, based on the year before to the selected only, if this is right, here you are a possible solution.&lt;/P&gt;&lt;P&gt;I hope this help you.&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2009 19:28:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160791#M504397</guid>
      <dc:creator />
      <dc:date>2009-12-09T19:28:25Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160792#M504398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Hi again.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;I'm so sorry, Miguel. It was not exactly what I was looking for. I feel I'm not clear enough to make you understand me. Let me try to explain in another way.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;In this application I know the structure (expression) was wrong. So, I corrected it as you had suggested and now it's OK. You were completely right about my mistake. But I'm using the same application to understand why I cannot combine the function &lt;I style="mso-bidi-font-style:normal;"&gt;aggr&lt;/I&gt; and &lt;I style="mso-bidi-font-style:normal;"&gt;Set Analysis&lt;/I&gt;.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;The expression below is the second column in my example and it has the correct values. Why? Because &lt;EM&gt;Set Analysis&lt;/EM&gt; ({$&amp;lt;Ano = {&lt;B&gt;&lt;I&gt;$(=max(Ano) - 1)&lt;/I&gt;&lt;/B&gt;}&amp;gt;}) returns the year 2008. So, the amount showed is related to Out/2008.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;But give a look at the field [Valor Liquido Mercadoria US$]. This field comes from the script, the division was made in the script level.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR style="margin:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt;sum ( {$&amp;lt;Ano = {&lt;B&gt;&lt;I&gt;$(=max(Ano) - 1)&lt;/I&gt;&lt;/B&gt;}&amp;gt;} [Valor Liquido Mercadoria US$])&lt;BR style="margin:0cm 0cm 0pt;" /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;The goal of the first column is to reproduce the same values that I get in second column. But there I'm combining &lt;EM&gt;Set Analysis&lt;/EM&gt; and the function &lt;EM&gt;aggr&lt;/EM&gt; to get the values. For my surprise the values refer to Out/2009 (third column) not Out/2008 like I hoped.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;In this expression &lt;EM&gt;Set Analysis&lt;/EM&gt; statement doesn't have any effect. The month is correct (Out) but the year should be 2008 not 2009 (the values are from 2009).&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR style="margin:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt;sum (&lt;BR style="margin:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt; aggr( {$&amp;lt;Ano = {*}&amp;gt; * 1&amp;lt;Ano = {&lt;B&gt;&lt;I&gt;$(=max(Ano) - 1)&lt;/I&gt;&lt;/B&gt;}&amp;gt;}&lt;BR style="margin:0cm 0cm 0pt;mso-layout-grid-align:none;" /&gt; [Valor Liquido Mercadoria] / [Valor Cotacao Dolar Exportacao], LinkNF))&lt;BR style="margin:0cm 0cm 0pt;" /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Can I combine &lt;EM&gt;Set Analysis&lt;/EM&gt; and the function &lt;EM&gt;aggr&lt;/EM&gt;? Does it work?&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Is there something wrong in the &lt;EM&gt;Set Analysis&lt;/EM&gt; statement?&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;The key point I'm asking is why the first column doesn't return the same amount as the second column. When I combine &lt;EM&gt;Set Analysis&lt;/EM&gt; and the function &lt;EM&gt;aggr&lt;/EM&gt; the &lt;EM&gt;Set Analysis&lt;/EM&gt; statement doesn't any effect on select the correct year (2008).&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Thank you so much.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Huberto.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2009 22:54:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160792#M504398</guid>
      <dc:creator />
      <dc:date>2009-12-09T22:54:07Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160793#M504399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Huberto,&lt;/P&gt;&lt;P&gt;Unfortunatelly I have bad news for you, I've proved why you can use the aggregate function into a set analysis, when you use the aggr function it omits the set which is being implemented, you can see and understand better looking at my example attached. The Ano column shows the diference between using the sum function with and without aggr function.&lt;/P&gt;&lt;P&gt;I hope this help you.&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 16:13:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160793#M504399</guid>
      <dc:creator />
      <dc:date>2009-12-10T16:13:16Z</dc:date>
    </item>
    <item>
      <title>How to combine Set Analysis and Aggr functions?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160794#M504400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Hi Miguel.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Thank you so much, you were very helpful.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;I figure out that, but like I'm new in QlikView I asked for the community to be sure.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;So, I'm going to think in another way to do what I need.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Best regards.&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0cm 0cm 0pt;"&gt;Huberto.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 16:43:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-combine-Set-Analysis-and-Aggr-functions/m-p/160794#M504400</guid>
      <dc:creator />
      <dc:date>2009-12-10T16:43:51Z</dc:date>
    </item>
  </channel>
</rss>

