<?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: Problem with partial sums in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712534#M1057452</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's only guessing then I don't know your datamodell well enough:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=1, avg(aggr(&lt;STRONG&gt;sum&lt;/STRONG&gt;(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS)), JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=1, avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS, JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=1, avg(NODISTINCT aggr(avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS)), JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look here how aggr() worked:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/03/07/aggr" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/07/aggr"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/07/aggr&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-used" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-used"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-used&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2014/05/19/function-classes" title="http://community.qlik.com/blogs/qlikviewdesignblog/2014/05/19/function-classes"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2014/05/19/function-classes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also helpful could be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/07/29/averages" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/07/29/averages"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/07/29/averages&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Oct 2014 09:16:55 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2014-10-14T09:16:55Z</dc:date>
    <item>
      <title>Problem with partial sums</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712531#M1057449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my pivot table, I have 3 dimensions: representative, cutomer and order number.&lt;/P&gt;&lt;P&gt;For the dimension "order number", I'm calcultating the average of the different quotes.&lt;/P&gt;&lt;P&gt;For the dimension "customer, I'm calculating the average of the different orders.&lt;BR /&gt;And finally for the dimension "representative", I need to get the average of the different customers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the first two dimension, it works perfectly. But when it comes to the las dimension. Instead of taking the average of the customers, it takes the average of the orders, which doesn't give the same value as if I calculate it manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the expression I use:&lt;/P&gt;&lt;P&gt;if(Dimensionality()=3, aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS), &lt;/P&gt;&lt;P&gt;&amp;nbsp; if(Dimensionality()=2, avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS)),&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(Dimensionality()=1, avg(aggr(avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS)), JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where:&lt;/P&gt;&lt;P&gt;JD_NDEVIS: order number&lt;/P&gt;&lt;P&gt;JD_REF_CLIENT: customer&lt;/P&gt;&lt;P&gt;JD_PX_TOTAL: value of the quote&lt;/P&gt;&lt;P&gt;JD_CODUNIQ: number of the quote&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do you think I could get to my result?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 12:01:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712531#M1057449</guid>
      <dc:creator />
      <dc:date>2014-10-13T12:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with partial sums</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712532#M1057450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe there is an aggr() too much and "JD_REF_CLIENT" should be in the inner aggr(), too. Also sometimes need the aggr() a NODISTINCT addition then per default calculates aggr() on a distinct level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 15:22:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712532#M1057450</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-10-13T15:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with partial sums</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712533#M1057451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=3, aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS),&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(Dimensionality()=2, avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS)),&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(Dimensionality()=1, sum(aggr(avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS, JD_REF_CLIENT)), JD_NDEVIS, JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It still doesn't change &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 07:57:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712533#M1057451</guid>
      <dc:creator />
      <dc:date>2014-10-14T07:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with partial sums</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712534#M1057452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's only guessing then I don't know your datamodell well enough:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=1, avg(aggr(&lt;STRONG&gt;sum&lt;/STRONG&gt;(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS)), JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=1, avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS, JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=1, avg(NODISTINCT aggr(avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS)), JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look here how aggr() worked:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/03/07/aggr" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/07/aggr"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/07/aggr&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-used" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-used"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/03/11/when-should-the-aggr-function-not-be-used&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2014/05/19/function-classes" title="http://community.qlik.com/blogs/qlikviewdesignblog/2014/05/19/function-classes"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2014/05/19/function-classes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also helpful could be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/blogs/qlikviewdesignblog/2013/07/29/averages" title="http://community.qlik.com/blogs/qlikviewdesignblog/2013/07/29/averages"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2013/07/29/averages&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:16:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712534#M1057452</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-10-14T09:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Problem with partial sums</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712535#M1057453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first one doens't help, and the second one still calculates the average on the number of orders and not on the numbers of customers &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For the third one, the nodistinct expression is not recognised by qlikview&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are the files, if it is easier for you &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:31:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712535#M1057453</guid>
      <dc:creator />
      <dc:date>2014-10-14T09:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with partial sums</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712536#M1057454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes my mistake, nodistinct belonged to aggr not to avg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Dimensionality()=1, avg(aggr(&lt;STRONG&gt;NODISTINCT&lt;/STRONG&gt; avg(aggr(sum(JD_PX_TOTAL)/count(JD_CODUNIQ), JD_NDEVIS)), JD_REF_CLIENT))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it's more a logical issue. Is the inner aggr-part from your original expression the right basis to extend or nested in further part or not?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:42:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712536#M1057454</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-10-14T09:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with partial sums</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712537#M1057455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if I understand &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, the first aggr part&amp;nbsp; should calculate the average value per customer and the second one (the outside one) should calculate the average value per representative. So adding all the customer values and dividing them by the number of customers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:49:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712537#M1057455</guid>
      <dc:creator />
      <dc:date>2014-10-14T09:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with partial sums</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712538#M1057457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If one of my expressions gives a wrong result I try to understand what has the expression calculated. If I know why is the result how it is (most through splitting the expressions in parts and/or calculate it manually) I could go further to modify the expression - if I don't understand the result then my actions are only trial and error ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could imagine that the in aggr() nested aggr() isn't the right way - maybe you need an expression like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(..., aggr() / aggr() ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look on the above links, especially "when you don't use aggr ..." and "which average...".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 10:56:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-partial-sums/m-p/712538#M1057457</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-10-14T10:56:39Z</dc:date>
    </item>
  </channel>
</rss>

