<?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: Distinct count and Avg in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658892#M49380</link>
    <description>&lt;P&gt;Thanks a lot. i am not sure what do you mean with "yourDimension"? There is no other dimension I guess. I just want to calc the average number of members and for that I count the ID Dimension.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Dec 2019 09:58:54 GMT</pubDate>
    <dc:creator>beat_roos</dc:creator>
    <dc:date>2019-12-18T09:58:54Z</dc:date>
    <item>
      <title>Distinct count and Avg</title>
      <link>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658879#M49378</link>
      <description>&lt;P&gt;Hi Community&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a new app I need to count the number of unique Members.&amp;nbsp;I do it by a distinct count:&amp;nbsp;&lt;BR /&gt;Count(distinct [Opp. Kontaktrollen: ID])&lt;BR /&gt;what works very good and I create a master key figure for that.&lt;/P&gt;&lt;P&gt;Next idea was to know the ave number of members. So I guess to calc an avg value by using this master key figure but I didn't found a way to calc with an existing key figure instead of a field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So next idea to just add the avg function to my calc like:&lt;BR /&gt;avg(Count(distinct [Opp. Kontaktrollen: ID]))&lt;BR /&gt;but now I get an error because nested aggregations are not allowed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me to solve that?&lt;BR /&gt;&lt;FONT face="inherit"&gt;I like to know (depending on the selection) what the avg &lt;/FONT&gt;number&lt;FONT face="inherit"&gt;&amp;nbsp;of unique members of my field Kontaktrollen:ID is.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 21:38:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658879#M49378</guid>
      <dc:creator>beat_roos</dc:creator>
      <dc:date>2021-12-20T21:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count and Avg</title>
      <link>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658889#M49379</link>
      <description>&lt;P&gt;To use nested aggregation you need to use Aggr function&lt;/P&gt;&lt;P&gt;try like below&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;avg(&lt;STRONG&gt;aggr&lt;/STRONG&gt;(Count(distinct [Opp. Kontaktrollen: ID]),&lt;STRONG&gt;YourDimension&lt;/STRONG&gt;))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 09:54:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658889#M49379</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2019-12-18T09:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count and Avg</title>
      <link>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658892#M49380</link>
      <description>&lt;P&gt;Thanks a lot. i am not sure what do you mean with "yourDimension"? There is no other dimension I guess. I just want to calc the average number of members and for that I count the ID Dimension.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 09:58:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658892#M49380</guid>
      <dc:creator>beat_roos</dc:creator>
      <dc:date>2019-12-18T09:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count and Avg</title>
      <link>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658911#M49382</link>
      <description>&lt;P&gt;First Aggregation function will always give you single value without using any dimension and taking Avg of that single value doesn't make any sense.&amp;nbsp;&lt;/P&gt;&lt;P&gt;let's say I have dataset like below&lt;/P&gt;&lt;P&gt;Load * inline [&lt;/P&gt;&lt;P&gt;ID, Name&lt;/P&gt;&lt;P&gt;1,a&lt;/P&gt;&lt;P&gt;1,b&lt;/P&gt;&lt;P&gt;2,a&lt;/P&gt;&lt;P&gt;2,c&lt;/P&gt;&lt;P&gt;3,a&lt;/P&gt;&lt;P&gt;3,b&lt;/P&gt;&lt;P&gt;4,b ];&lt;/P&gt;&lt;P&gt;if I use count (distinct ID) I will get 4 (as distinct&amp;nbsp; values are 1,2,3,4). Now you can't take Avg for single value returned from first aggregation.&lt;/P&gt;&lt;P&gt;But If you want to take Avg against some dimension then that is absolutely possible using Aggr function like below&lt;/P&gt;&lt;P&gt;Avg(aggr(Count(distinct ID),Name))&lt;/P&gt;&lt;P&gt;Above expression works as follows&lt;/P&gt;&lt;P&gt;1) Qlik internally creates a table by aggregating count for each value of Name&lt;/P&gt;&lt;P&gt;Name,CountID&lt;/P&gt;&lt;P&gt;a,3&lt;/P&gt;&lt;P&gt;b,2&lt;/P&gt;&lt;P&gt;c,1&lt;/P&gt;&lt;P&gt;&amp;nbsp;2) Qlik then calculates Avg value on top of the table created in step 1) for CountID as &lt;STRONG&gt;2&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This how nested aggregation works in Qlik. So it's important to consider dimension against which you want to perform nested aggregation.&lt;/P&gt;&lt;P&gt;If you can provide some sample data with expected output then it will be helpful&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 11:01:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1658911#M49382</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2019-12-18T11:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count and Avg</title>
      <link>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1659008#M49389</link>
      <description>&lt;P&gt;totally agree. Now I understand it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thank you very much for your fast and kind help!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 13:38:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Distinct-count-and-Avg/m-p/1659008#M49389</guid>
      <dc:creator>beat_roos</dc:creator>
      <dc:date>2019-12-18T13:38:21Z</dc:date>
    </item>
  </channel>
</rss>

