<?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: Aggregated function with two counts or sum and count in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggregated-function-with-two-counts-or-sum-and-count/m-p/1703998#M53959</link>
    <description>&lt;P&gt;The&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense/April2020/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/aggr.htm" target="_self"&gt;Aggr&lt;/A&gt;&amp;nbsp;function creates a virtual table.&lt;/P&gt;&lt;P&gt;I used the following formulas:&lt;/P&gt;&lt;P&gt;count(aggr(count(Serialnumber),Timestamp)) which returns a 2&lt;/P&gt;&lt;P&gt;sum(aggr(count(Serialnumber),Timestamp)) which returns a 10, which is what I expected, not a 20&lt;/P&gt;&lt;P&gt;sum(aggr(Distinct count(Serialnumber),Timestamp)) which returns a 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Aggr function returns 2 rows which each have a value of 5.&amp;nbsp; The first formula counts the rows and returns 2.&amp;nbsp; The second formula adds the rows together and returns 10.&amp;nbsp; The third formula is the same as the second formula, distinct is the default and returns 10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how you got 20 or zero.&lt;/P&gt;</description>
    <pubDate>Wed, 20 May 2020 22:01:20 GMT</pubDate>
    <dc:creator>jwjackso</dc:creator>
    <dc:date>2020-05-20T22:01:20Z</dc:date>
    <item>
      <title>Aggregated function with two counts or sum and count</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregated-function-with-two-counts-or-sum-and-count/m-p/1703973#M53957</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i hope everyone is well.&lt;/P&gt;&lt;P&gt;I created a table in Qliksense.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To understand a aggregated function I just changed the aggregation between sum and count. For me aggregation functions I saw mostly in explanations with variations with sum(sales) was easier to understand than with counts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance I have table with two main columns. One is called 'Serialnumber' (always unique numbers) and the other one is called 'Timestamp' (the time the date the number was created):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" width="174" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="87" height="21"&gt;Serialnumber&lt;/TD&gt;&lt;TD width="87"&gt;Timestamp&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33333&lt;/TD&gt;&lt;TD&gt;06.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33334&lt;/TD&gt;&lt;TD&gt;06.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33335&lt;/TD&gt;&lt;TD&gt;06.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33336&lt;/TD&gt;&lt;TD&gt;06.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33337&lt;/TD&gt;&lt;TD&gt;06.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33338&lt;/TD&gt;&lt;TD&gt;07.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33339&lt;/TD&gt;&lt;TD&gt;07.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33340&lt;/TD&gt;&lt;TD&gt;07.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33341&lt;/TD&gt;&lt;TD&gt;07.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="21"&gt;BF33342&lt;/TD&gt;&lt;TD&gt;07.05.20&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I add two other columns:&amp;nbsp;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;count(aggr(count]|[Serialnumber], [Timestamp])&lt;/STRONG&gt;&lt;/FONT&gt; AND&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;sum(aggr(count]|[Serialnumber], [Timestamp])&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;The&amp;nbsp; first aggregation function gives me the value count of 2. Even if I have ten Serialnumbers in total, does it just counts the two different dates ?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;The second aggregations is even more confusing. Since I have the 2 counts in the first functions, when I changed to "sum" it gives me 20. How can this make sense?&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;When I add a 'distinct" in the second one&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&lt;FONT color="#800080"&gt;sum(aggr(count distinct]|[Serialnumber], [Timestamp])&lt;/FONT&gt; &lt;FONT color="#000000"&gt;I suddenly get zero!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I hope someone can explain all 3 variations in easy words for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance. Stay safe!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 20:12:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregated-function-with-two-counts-or-sum-and-count/m-p/1703973#M53957</guid>
      <dc:creator>Applicable88</dc:creator>
      <dc:date>2020-05-20T20:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregated function with two counts or sum and count</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregated-function-with-two-counts-or-sum-and-count/m-p/1703998#M53959</link>
      <description>&lt;P&gt;The&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense/April2020/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/aggr.htm" target="_self"&gt;Aggr&lt;/A&gt;&amp;nbsp;function creates a virtual table.&lt;/P&gt;&lt;P&gt;I used the following formulas:&lt;/P&gt;&lt;P&gt;count(aggr(count(Serialnumber),Timestamp)) which returns a 2&lt;/P&gt;&lt;P&gt;sum(aggr(count(Serialnumber),Timestamp)) which returns a 10, which is what I expected, not a 20&lt;/P&gt;&lt;P&gt;sum(aggr(Distinct count(Serialnumber),Timestamp)) which returns a 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Aggr function returns 2 rows which each have a value of 5.&amp;nbsp; The first formula counts the rows and returns 2.&amp;nbsp; The second formula adds the rows together and returns 10.&amp;nbsp; The third formula is the same as the second formula, distinct is the default and returns 10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how you got 20 or zero.&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 22:01:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregated-function-with-two-counts-or-sum-and-count/m-p/1703998#M53959</guid>
      <dc:creator>jwjackso</dc:creator>
      <dc:date>2020-05-20T22:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregated function with two counts or sum and count</title>
      <link>https://community.qlik.com/t5/App-Development/Aggregated-function-with-two-counts-or-sum-and-count/m-p/1704370#M54000</link>
      <description>&lt;P&gt;Thank you very much! Very good explained. My counts really weren't the same at work. Maybe there is something I missed in the data. When I'm back to office I recheck my data and write you back if I cannot find the mistake myself.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stay safe.&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 11:53:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggregated-function-with-two-counts-or-sum-and-count/m-p/1704370#M54000</guid>
      <dc:creator>Applicable88</dc:creator>
      <dc:date>2020-05-22T11:53:56Z</dc:date>
    </item>
  </channel>
</rss>

