<?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: Count distinct vs Count total distinct in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-distinct-vs-Count-total-distinct/m-p/1557530#M743416</link>
    <description>&lt;P&gt;The TOTAL specifies that the dimension of the table or chart is ignored when doing the calculation. It is useful for getting a percentage contribution in a field. For instance would give the percentage of IDs which fell on that row.&lt;/P&gt;&lt;P&gt;count(DISTINCT ID) / count(DISTINCT TOTAL ID)&lt;/P&gt;&lt;P&gt;To get the total regardless of selections you need to use simple Set Analysis, and insert a {1} in the statement. The following would give you the selected count as a percentage of the whole data set:&lt;/P&gt;&lt;P&gt;count(DISTINCT ID) / count({1} DISTINCT ID)&lt;/P&gt;&lt;P&gt;I would recommend creating a simple table with expressions written all three ways (i.e. plain, with TOTAL and with {1}).&lt;/P&gt;&lt;P&gt;Also, getting counts of rows is more efficient if you create a counter on each row. In your load script have this;&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;&amp;nbsp; 1 as RowCount,&lt;BR /&gt;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;You can then have sum(RowCount), sum(TOTAL RowCount) and sum({1}RowCount). This is simpler syntax, more efficient and can avoid some oddities around using DISTINCT.&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
    <pubDate>Sun, 17 Mar 2019 00:44:45 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2019-03-17T00:44:45Z</dc:date>
    <item>
      <title>Count distinct vs Count total distinct</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-vs-Count-total-distinct/m-p/1557529#M743415</link>
      <description>&lt;P&gt;Hello all&lt;/P&gt;&lt;P&gt;quick question please : when exactly should i use &lt;STRONG&gt;count(distinct &lt;/STRONG&gt;&lt;EM&gt;categories&lt;/EM&gt;&lt;STRONG&gt;)&lt;/STRONG&gt; and &lt;STRONG&gt;count (total distinct &lt;/STRONG&gt;&lt;EM&gt;categories&lt;/EM&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;when i use the second one, does it consider the filtered parameter i will make on Qlik (for exemple if i select certains years...) ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-vs-Count-total-distinct/m-p/1557529#M743415</guid>
      <dc:creator>ahmedwank</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count distinct vs Count total distinct</title>
      <link>https://community.qlik.com/t5/QlikView/Count-distinct-vs-Count-total-distinct/m-p/1557530#M743416</link>
      <description>&lt;P&gt;The TOTAL specifies that the dimension of the table or chart is ignored when doing the calculation. It is useful for getting a percentage contribution in a field. For instance would give the percentage of IDs which fell on that row.&lt;/P&gt;&lt;P&gt;count(DISTINCT ID) / count(DISTINCT TOTAL ID)&lt;/P&gt;&lt;P&gt;To get the total regardless of selections you need to use simple Set Analysis, and insert a {1} in the statement. The following would give you the selected count as a percentage of the whole data set:&lt;/P&gt;&lt;P&gt;count(DISTINCT ID) / count({1} DISTINCT ID)&lt;/P&gt;&lt;P&gt;I would recommend creating a simple table with expressions written all three ways (i.e. plain, with TOTAL and with {1}).&lt;/P&gt;&lt;P&gt;Also, getting counts of rows is more efficient if you create a counter on each row. In your load script have this;&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;&amp;nbsp; 1 as RowCount,&lt;BR /&gt;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;You can then have sum(RowCount), sum(TOTAL RowCount) and sum({1}RowCount). This is simpler syntax, more efficient and can avoid some oddities around using DISTINCT.&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Sun, 17 Mar 2019 00:44:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-distinct-vs-Count-total-distinct/m-p/1557530#M743416</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2019-03-17T00:44:45Z</dc:date>
    </item>
  </channel>
</rss>

