<?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: Aggr and distinct function in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Aggr-and-distinct-function/m-p/2114361#M90968</link>
    <description>&lt;P&gt;Hi, first of all, in your attached QVD field [Vehicle Number] one value is null, other is 'non-breaking space' (or chr(160)). It is not the same, so with group by you get 2 values. I guess (but you should test), when converting to csv, this chr(160) is removed and group by just give you one line with null value?&lt;/P&gt;
&lt;P&gt;Other thing, count() is not counting null values, so it is correct that '&lt;STRONG&gt;count( distinct [Vehicle Number])--&amp;gt;1&lt;/STRONG&gt;' as only value it is see is this 'space'. Once again, I guess, that '&lt;STRONG&gt;count(aggr(count([Vehicle Number]),[Vehicle Number]))--&amp;gt;2&lt;/STRONG&gt;' basically works as countcount: you aggregate count per [Vehicle Number] and get values 0 (for null) and 1 (for space). And you count these values (0 and 1) again, so you get 2 as they are 2 different values (something like count( [Vehicle Number]) + NullCount([Vehicle Number])).&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;However, this is just my dubious opinion.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;Perhaps someone could clarify or even refute this.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2023 05:49:11 GMT</pubDate>
    <dc:creator>justISO</dc:creator>
    <dc:date>2023-09-07T05:49:11Z</dc:date>
    <item>
      <title>Aggr and distinct function</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-and-distinct-function/m-p/2114229#M90963</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;I wrote a Qlik expression&lt;STRONG&gt;count( distinct [Vehicle Number])&lt;/STRONG&gt;and&lt;STRONG&gt;&amp;nbsp;count(aggr(count([Vehicle Number]),[Vehicle Number])).&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Logically both of them should provide a count of distinct values. But it's showing exceptional cases for data in the attached QVD.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;count( distinct [Vehicle Number])--&amp;gt;1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;count(aggr(count([Vehicle Number]),[Vehicle Number]))--&amp;gt;2&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When I do &lt;STRONG&gt;group by&lt;/STRONG&gt; for the attached QVD with Vehicle Number the number of lines fetched is 2&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LOAD [Vehicle Number],count([Vehicle Number])&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;as count &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;[Qlik_team_Final.qvd]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;(qvd)&amp;nbsp;group by [Vehicle Number];&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;But if I convert this QVD to CSV file and try to do the same &lt;STRONG&gt;group b&lt;/STRONG&gt;y, the number of lines fetched is 1&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LOAD [Vehicle Number],count([Vehicle Number])&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;as count &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;[Qlik_team_Final.csv](txt, utf8, embedded labels, delimiter is ',', msq)&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;group by [Vehicle Number];&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Can someone please help to get this clarified?&lt;/P&gt;
&lt;P&gt;Thank You&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 18:32:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-and-distinct-function/m-p/2114229#M90963</guid>
      <dc:creator>vajid4525</dc:creator>
      <dc:date>2023-09-06T18:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Aggr and distinct function</title>
      <link>https://community.qlik.com/t5/App-Development/Aggr-and-distinct-function/m-p/2114361#M90968</link>
      <description>&lt;P&gt;Hi, first of all, in your attached QVD field [Vehicle Number] one value is null, other is 'non-breaking space' (or chr(160)). It is not the same, so with group by you get 2 values. I guess (but you should test), when converting to csv, this chr(160) is removed and group by just give you one line with null value?&lt;/P&gt;
&lt;P&gt;Other thing, count() is not counting null values, so it is correct that '&lt;STRONG&gt;count( distinct [Vehicle Number])--&amp;gt;1&lt;/STRONG&gt;' as only value it is see is this 'space'. Once again, I guess, that '&lt;STRONG&gt;count(aggr(count([Vehicle Number]),[Vehicle Number]))--&amp;gt;2&lt;/STRONG&gt;' basically works as countcount: you aggregate count per [Vehicle Number] and get values 0 (for null) and 1 (for space). And you count these values (0 and 1) again, so you get 2 as they are 2 different values (something like count( [Vehicle Number]) + NullCount([Vehicle Number])).&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="HwtZe"&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;However, this is just my dubious opinion.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;Perhaps someone could clarify or even refute this.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 05:49:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Aggr-and-distinct-function/m-p/2114361#M90968</guid>
      <dc:creator>justISO</dc:creator>
      <dc:date>2023-09-07T05:49:11Z</dc:date>
    </item>
  </channel>
</rss>

