<?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: Aggregation Query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018195#M466532</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or may be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Sum(DISTINCT Aggr(Sum(TOTAL &amp;lt;Plant&amp;gt; Aggr(Avg(Days)*sum(Value), Plant, Month))/Sum(TOTAL &amp;lt;Plant&amp;gt; Aggr(If(Sum(Value) = 0, 0, Avg(Days)), Plant, Month)), Plant, Month))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gives me:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/113098_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is off because in your original attached Excel file you were multiplying by 31 for month of September. I changed it to 30 and the result seem to match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/113105_Capture.PNG" style="height: 196px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Used Gysbert's QVW to make changes (Thanks to him for letting&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 31 Jan 2016 15:59:40 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-01-31T15:59:40Z</dc:date>
    <item>
      <title>Aggregation Query</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018192#M466529</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;Have been stuck into this for a while.&lt;/P&gt;&lt;P&gt;Need your valuable suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Example.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/113099_Example.jpg" style="height: 163px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As we can see in above image there are values for different plants over months in above table &amp;amp; below are the calculations performed for the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is as below:&lt;/P&gt;&lt;P&gt;Step 1: Multiply the cell values by no. of days for respective months&lt;/P&gt;&lt;P&gt;Step 2: Further we sum up the derived values from step 1 at individual plant level &amp;amp; divide it by tot. no. of days for all months.&lt;/P&gt;&lt;P&gt;(Note: Only to consider tot. days for months where values are not 0)&lt;/P&gt;&lt;P&gt;Step 3: Finally we have to show the sum of values derived from step 2 for all plants as highlighted in green.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been successful in achieving the Division column (in above image) so far for individual plant, i.e. when I select a particular plant.&lt;/P&gt;&lt;P&gt;But when I do not select any plant, my aggregation expression fails since all plants do not have same tot. no. of days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to show the final value in a text box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value that it should show is the one that is highlighted in green which is the sum at individual plant level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But somehow, I am getting a value which is 1058600(total value from SUM column) / 183 (Tot. no of days for all months) = &lt;STRONG&gt;5784.7&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions would be helpful for above mentioned scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also attaching excel so that you can check for required calculations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Jan 2016 04:48:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018192#M466529</guid>
      <dc:creator>yuvraj_33</dc:creator>
      <dc:date>2016-01-31T04:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation Query</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018193#M466530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get 5751.91 as result. Looks like you're using a different number of days for september.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Jan 2016 15:43:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018193#M466530</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-01-31T15:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation Query</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018194#M466531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does your September show 31 days?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Jan 2016 15:43:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018194#M466531</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-01-31T15:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation Query</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018195#M466532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or may be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Sum(DISTINCT Aggr(Sum(TOTAL &amp;lt;Plant&amp;gt; Aggr(Avg(Days)*sum(Value), Plant, Month))/Sum(TOTAL &amp;lt;Plant&amp;gt; Aggr(If(Sum(Value) = 0, 0, Avg(Days)), Plant, Month)), Plant, Month))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gives me:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/113098_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is off because in your original attached Excel file you were multiplying by 31 for month of September. I changed it to 30 and the result seem to match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/113105_Capture.PNG" style="height: 196px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Used Gysbert's QVW to make changes (Thanks to him for letting&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Jan 2016 15:59:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018195#M466532</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-01-31T15:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation Query</title>
      <link>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018196#M466533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your responses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yeh sorry, have mistakenly considered 31 days for september.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would check for your suggestion whether it works in my application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you once again, @Gysbert, @sunny, @swuehl.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Jan 2016 17:00:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Aggregation-Query/m-p/1018196#M466533</guid>
      <dc:creator>yuvraj_33</dc:creator>
      <dc:date>2016-01-31T17:00:28Z</dc:date>
    </item>
  </channel>
</rss>

