<?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: How can I use sum() instead of count(Distinct ) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932289#M967281</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As others have said; today you can use Count(Distinct) without a performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you really want to use SUM instead of count(Distinct) you can do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fact:&lt;/P&gt;&lt;P&gt;load %Keytobecounted, Facts, numbers, etc from fact.qvd (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CountingTable:&lt;/P&gt;&lt;P&gt;load distinct %Keytobecounted, 1 as Keycounter resident Fact;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This creates a table with the unique keys and a field you can sum that will equal a count of keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now you can use the expression Sum(Keycounter) instead of Count(Distinct %Keytobecounted).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Sep 2015 10:09:44 GMT</pubDate>
    <dc:creator>simenkg</dc:creator>
    <dc:date>2015-09-25T10:09:44Z</dc:date>
    <item>
      <title>How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932278#M967265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is said that using Sum() instead of count(Distinct ) the performance will increase. But I have duplicate Key values in my data.&lt;/P&gt;&lt;P&gt;So how can I use it. Can anyone help me on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anjali Gupta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 10:53:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932278#M967265</guid>
      <dc:creator />
      <dc:date>2015-09-24T10:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932279#M967267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anjali,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you please provide more clarity on your question. Distinct obviously cost the query performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sreeni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 10:55:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932279#M967267</guid>
      <dc:creator>SreeniJD</dc:creator>
      <dc:date>2015-09-24T10:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932280#M967269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;did you read this?&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3381"&gt;A Myth About Count(distinct …)&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 10:56:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932280#M967269</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-09-24T10:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932281#M967271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Those days are gone. Now QlikView uses multi-threading, and there is no such performance issue with distinct clause. Read: &lt;A href="https://community.qlik.com/qlik-blogpost/3381"&gt;A Myth About Count(distinct …)&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 10:58:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932281#M967271</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2015-09-24T10:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932282#M967273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maxgro, I don't want to use count(Distinct) instead I want to use Sum (). How can I use that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 12:45:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932282#M967273</guid>
      <dc:creator />
      <dc:date>2015-09-24T12:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932283#M967275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard Pearce of Qlikcentral also has a blog that might useful to read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://qlikcentral.com/2015/08/04/count-or-sum1-which-is-best/" title="http://qlikcentral.com/2015/08/04/count-or-sum1-which-is-best/"&gt;http://qlikcentral.com/2015/08/04/count-or-sum1-which-is-best/&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 12:51:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932283#M967275</guid>
      <dc:creator>Gabriel</dc:creator>
      <dc:date>2015-09-24T12:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932284#M967276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use a record counter at script level and then use sum(recordcounter)...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 12:55:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932284#M967276</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-24T12:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932285#M967277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balraj, How to use a record counter? Can you explain.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 08:07:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932285#M967277</guid>
      <dc:creator />
      <dc:date>2015-09-25T08:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932286#M967278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please provide sample data&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 08:12:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932286#M967278</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2015-09-25T08:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932287#M967279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anjali,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in you load script add an extra line of code like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AS RecordCounter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in the frontend you can do a Sum(RecordCounter) to count number of rows. Please beware, if for example you have data with say Orders with multiple Orderlines and you want to count unique orders then this won't work. Instead if you want to count orderlines it wil work. Otherwise you need to split the tabels (Order table and Orderline table).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you get the picture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetz,&lt;/P&gt;&lt;P&gt;Marc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 10:03:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932287#M967279</guid>
      <dc:creator />
      <dc:date>2015-09-25T10:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932288#M967280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Despite the &lt;EM&gt;Myth of Count&lt;/EM&gt; &lt;EM&gt;Distinct&lt;/EM&gt;, record counters are still very useful and I use them extensively.&amp;nbsp; Well worth checking out the suggestions / links that have been suggested.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 10:07:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932288#M967280</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-25T10:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932289#M967281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As others have said; today you can use Count(Distinct) without a performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you really want to use SUM instead of count(Distinct) you can do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fact:&lt;/P&gt;&lt;P&gt;load %Keytobecounted, Facts, numbers, etc from fact.qvd (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CountingTable:&lt;/P&gt;&lt;P&gt;load distinct %Keytobecounted, 1 as Keycounter resident Fact;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This creates a table with the unique keys and a field you can sum that will equal a count of keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now you can use the expression Sum(Keycounter) instead of Count(Distinct %Keytobecounted).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 10:09:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932289#M967281</guid>
      <dc:creator>simenkg</dc:creator>
      <dc:date>2015-09-25T10:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932290#M967282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anjali wrote" &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;It is said that using Sum() instead of count(Distinct ) the performance will increase.".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;It is not correct. We can use either one. Count(Distinct) won't reduce the performance.&lt;/P&gt;&lt;P&gt;Read tresco's link.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 10:14:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932290#M967282</guid>
      <dc:creator>qlikviewwizard</dc:creator>
      <dc:date>2015-09-25T10:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use sum() instead of count(Distinct )</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932291#M967283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like many things &lt;EM&gt;this all depends.&lt;/EM&gt;.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count Distinct used to be single threaded and hence could be slow.&amp;nbsp; Some releases ago it was made multi-threaded which made it faster dependent on how many processor cores you have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it will take more processor cycles to execute, albeit striped across available cores.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Processor cycles = Electricity used = Heat produced = Global warming&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I am being pedantic here, generating electricity produces CO2 and every little helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Sep 2015 10:33:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-use-sum-instead-of-count-Distinct/m-p/932291#M967283</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-25T10:33:31Z</dc:date>
    </item>
  </channel>
</rss>

