<?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 in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1614416#M737293</link>
    <description>&lt;P&gt;Is your expression just this?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Max({&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or do you have&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Max({&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;lt;/year={$(=max(year)-1)}&amp;gt;&amp;lt;/year={$(=max(year)-1)}&amp;gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I don't really know what the part in red is for.&lt;/P&gt;&lt;P&gt;Going back to your question....&lt;/P&gt;&lt;P&gt;The reason the set analysis is used twice is because of the set analysis condition you have. You don't want the Sum of Sales for the current year, but the last year. Without selection in year field the below two expressions will work the same way&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max({&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max(aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when you select a single year (let's say 2019), the inner set analysis will be wanting to show 2018 and outer one without a set analysis will only want to show 2019 because 2018 is out of selection. Another expression which can work is this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max({&amp;lt;year&amp;gt;} aggr(Sum({&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2019 11:00:15 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-08-21T11:00:15Z</dc:date>
    <item>
      <title>SET ANALYSIS WITH AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1606266#M737290</link>
      <description>&lt;P&gt;Guys i have one query , here we are using aggr function to find out max sales by company and product ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My query is why we are set analaysis twice , what will be result if we use only once in aggr function ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;query :Max({&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&amp;lt;/year={$(=max(year)-1)}&amp;gt;&amp;lt;/year={$(=max(year)-1)}&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;MANU&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 02:54:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1606266#M737290</guid>
      <dc:creator>manu1512</dc:creator>
      <dc:date>2024-11-16T02:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: SET ANALYSIS WITH AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1614271#M737291</link>
      <description>&lt;P&gt;Manu, It will likely be more helpful if you can attach a sample app on this one as well, as I am sure the developers that could help likely need to see the underlying data model and expression in context of things in order to provide a proper answer for you on this one...&lt;/P&gt;
&lt;P&gt;Here is a Help link that may be somewhat helpful though, and there are a couple of links at the bottom of the Help post that could provide further info as well that may help you get things sorted on your own here.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/ChartFunctions/define-aggregation-scope.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/ChartFunctions/define-aggregation-scope.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 12:22:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1614271#M737291</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2019-08-20T12:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: SET ANALYSIS WITH AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1614402#M737292</link>
      <description>&lt;P&gt;It depends always on the context of an (nested) aggregation if you need to apply (the same or different one) conditions / set analysis and/or qualifier (total, distinct) on the inner and/or the outer aggregation. I think the best explanation about it could you find here: &lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Set-Analysis-in-the-Aggr-function/ba-p/1463822" target="_blank" rel="noopener"&gt;Set-Analysis-in-the-Aggr-function&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 15:13:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1614402#M737292</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-08-20T15:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: SET ANALYSIS WITH AGGR</title>
      <link>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1614416#M737293</link>
      <description>&lt;P&gt;Is your expression just this?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Max({&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or do you have&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Max({&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&amp;lt;/year={$(=max(year)-1)}&amp;gt;&amp;lt;/year={$(=max(year)-1)}&amp;gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I don't really know what the part in red is for.&lt;/P&gt;&lt;P&gt;Going back to your question....&lt;/P&gt;&lt;P&gt;The reason the set analysis is used twice is because of the set analysis condition you have. You don't want the Sum of Sales for the current year, but the last year. Without selection in year field the below two expressions will work the same way&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max({&amp;lt;year={$(=max(year)-1)}&amp;gt;} aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max(aggr (sum( {&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when you select a single year (let's say 2019), the inner set analysis will be wanting to show 2018 and outer one without a set analysis will only want to show 2019 because 2018 is out of selection. Another expression which can work is this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Max({&amp;lt;year&amp;gt;} aggr(Sum({&amp;lt;year={$(=max(year)-1)}&amp;gt;} Sale),Company_Name,Product))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 11:00:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/SET-ANALYSIS-WITH-AGGR/m-p/1614416#M737293</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-08-21T11:00:15Z</dc:date>
    </item>
  </channel>
</rss>

