<?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 double aggregation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387099#M485582</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure what you want and I'm even less sure it's possible. I can get you the same AVG user / Channel value for all four fractiles by adding a NODISTINCT to the aggr function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avg( aggr(NODISTINCT count({1} DISTINCT user_id),u_mega_monthly_channel_spend_key))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can only return one value since it's aggregated only over one dimension, i.e.&amp;nbsp; u_mega_monthly_channel_spend_key. And it's not possible to aggregate over a calculated dimension. So an average for each fractile isn't possible this way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm out of ideas on this one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Apr 2013 17:31:37 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-04-23T17:31:37Z</dc:date>
    <item>
      <title>problem with double aggregation</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387096#M485579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i'm trying to calculate some avg. within some calculated dimensions.&lt;/P&gt;&lt;P&gt;Therefor i need to know for every user in my user table how many users share the same channel_key with him.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so in a simplified form my users table would look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user_id|u_mega_monthly_channel_spend_key&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using &lt;EM&gt;u_mega_monthly_channel_spend_key &lt;/EM&gt;as a dimension is not an option in this case, sinc there are already some complex calculated dimensions in place instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But actually, from what i understand the following formula should add the user_count per &lt;EM&gt;u_mega_monthly_channel_spend_key &lt;/EM&gt;to the user&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aggr(aggr(count({1}DISTINCT user_id),u_mega_monthly_channel_spend_key),user_id)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should enable me then to calculated the AVGs per user within my calc-dim.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But somehow the value shows up only in one of the columns of the calc-dim.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i create a test-table which has just the user_id as dimension, then i see, that for each &lt;EM&gt;u_mega_monthly_channel_spend_key &lt;/EM&gt;only one user get's assigned the total count value, the others just show '-' for the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to solve this for 2days now, so any help would be really appreciated so much, so huge thanks in advance already &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: My data-model is extremely complex, so adding the solution with consistent fake-data is atm not an option &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Apr 2013 17:39:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387096#M485579</guid>
      <dc:creator />
      <dc:date>2013-04-22T17:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: problem with double aggregation</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387097#M485580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this does what you want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;STRONG&gt;avg(aggr(count({1}DISTINCT user_id),u_mega_monthly_channel_spend_key)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not please post a sample document. See &lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-1290"&gt;this document&lt;/A&gt; for how to prepare an example with reduced and (optionally) scrambled data.&lt;SPAN style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Apr 2013 17:58:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387097#M485580</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-04-22T17:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: problem with double aggregation</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387098#M485581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;i already tried this as well, doesn't help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've created a reduced test-document.&lt;/P&gt;&lt;P&gt;On the Net Margin % table u can see the AVG users / Channel only being calculated for the "Worse 40%"-Fractile.&lt;/P&gt;&lt;P&gt;When u Create a table with user_id as dim, u'll see that the aggregation was only computed for one user of the channel.&lt;/P&gt;&lt;P&gt;I'm MIssing the value to calculate the AVG CPA column correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any more ideas? (The problem is also that i can't compute this field on sql-side since the grouping of the utm-tags which then leads to a channel key is read from an excel file that get's updated by the marketing guys daily and is joined with the sql-data in the loadscript...)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 08:58:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387098#M485581</guid>
      <dc:creator />
      <dc:date>2013-04-23T08:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: problem with double aggregation</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387099#M485582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure what you want and I'm even less sure it's possible. I can get you the same AVG user / Channel value for all four fractiles by adding a NODISTINCT to the aggr function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avg( aggr(NODISTINCT count({1} DISTINCT user_id),u_mega_monthly_channel_spend_key))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can only return one value since it's aggregated only over one dimension, i.e.&amp;nbsp; u_mega_monthly_channel_spend_key. And it's not possible to aggregate over a calculated dimension. So an average for each fractile isn't possible this way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm out of ideas on this one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 17:31:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387099#M485582</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-04-23T17:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: problem with double aggregation</title>
      <link>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387100#M485583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gysbert u're a genious! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;That's exactly what i wanted.. of course as long as there is only one channel selected this will get the same result for all fractiles.&lt;/P&gt;&lt;P&gt;But when i selected several one, then i have different sets of channels in the fractiles.&lt;/P&gt;&lt;P&gt;I still don't fully understand why i have to add &lt;EM&gt;nodistinct&lt;/EM&gt;, which i didn't need to add to the avg spend per user:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;avg(aggr(sum(Spend),user_id) )&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;there it worked as suspected, but for the users-in-same-channel it didn't.&lt;/P&gt;&lt;P&gt;So if you could tell me the difference between this and the users-in-same-channel formel :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;avg(aggr(aggr(nodistinct count({1}DISTINCT user_id),u_mega_monthly_channel_spend_key),user_id))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;that would be very enlightening.&lt;/P&gt;&lt;P&gt;But huge thx already for the solution, this really helps alot!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 17:56:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/problem-with-double-aggregation/m-p/387100#M485583</guid>
      <dc:creator />
      <dc:date>2013-04-23T17:56:31Z</dc:date>
    </item>
  </channel>
</rss>

