<?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: year aggregation different from sum of month aggregation in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/year-aggregation-different-from-sum-of-month-aggregation/m-p/1704065#M53976</link>
    <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;I'm curious what your use case is for adding ratios up?&lt;/P&gt;&lt;P&gt;What you are effectively after is a multi step aggregation - like a sum of averages or average of sums, only this time it is a sum of ratios where the ratio is calculated a month grain and then straight summed up. In Qlik, this is achieved by the Aggr() statement. A function that allows for operations similar to that of a SQL GROUP BY statement if you are familiar with SQL.&lt;/P&gt;&lt;P&gt;I've attached a fully worked example to aid your studies, but if you just need an example expression - the one I used in my example app looks like this:&amp;nbsp;sum(aggr(sum(Value)/sum(Cost),Year,Quarter,Month))&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;-Jonas&lt;/P&gt;</description>
    <pubDate>Thu, 21 May 2020 05:58:20 GMT</pubDate>
    <dc:creator>JonasValleskog</dc:creator>
    <dc:date>2020-05-21T05:58:20Z</dc:date>
    <item>
      <title>year aggregation different from sum of month aggregation</title>
      <link>https://community.qlik.com/t5/App-Development/year-aggregation-different-from-sum-of-month-aggregation/m-p/1703878#M53940</link>
      <description>&lt;P&gt;Hi everybody, in the same graph, I can aggregate data by Year/Quarter/Month&lt;/P&gt;&lt;P&gt;And year aggregation is different from sum of month aggregation.&lt;/P&gt;&lt;P&gt;After investigating, the problem comes from the formula in the graph, to simplify,&lt;BR /&gt;let's say : formula=sum(a)/&lt;SPAN&gt;sum(&lt;/SPAN&gt;b).&lt;BR /&gt;So for the first quarter for exemple, the automatic sum for the quarter will be equivalent to (a1+a2+a3)/(b1+b2+b3) which is different from the sum of the 3 first months : (a1/b1)+(a2/b2)+(a3/b3).&lt;/P&gt;&lt;P&gt;Hope my question is clear enough.&lt;BR /&gt;Is there a way to solve this problem ? Any suggestions ?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:36:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/year-aggregation-different-from-sum-of-month-aggregation/m-p/1703878#M53940</guid>
      <dc:creator>bertrand01</dc:creator>
      <dc:date>2024-11-16T18:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: year aggregation different from sum of month aggregation</title>
      <link>https://community.qlik.com/t5/App-Development/year-aggregation-different-from-sum-of-month-aggregation/m-p/1704065#M53976</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;I'm curious what your use case is for adding ratios up?&lt;/P&gt;&lt;P&gt;What you are effectively after is a multi step aggregation - like a sum of averages or average of sums, only this time it is a sum of ratios where the ratio is calculated a month grain and then straight summed up. In Qlik, this is achieved by the Aggr() statement. A function that allows for operations similar to that of a SQL GROUP BY statement if you are familiar with SQL.&lt;/P&gt;&lt;P&gt;I've attached a fully worked example to aid your studies, but if you just need an example expression - the one I used in my example app looks like this:&amp;nbsp;sum(aggr(sum(Value)/sum(Cost),Year,Quarter,Month))&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;-Jonas&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 05:58:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/year-aggregation-different-from-sum-of-month-aggregation/m-p/1704065#M53976</guid>
      <dc:creator>JonasValleskog</dc:creator>
      <dc:date>2020-05-21T05:58:20Z</dc:date>
    </item>
  </channel>
</rss>

