<?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 I need something faster than count(distinct in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225726#M77993</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are correct. I don't see any way to make that more effecient. You need to perform a million if statements, there isn't any way to make that fast. Flags would be an option, but you can't modify the load.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Dec 2010 18:15:12 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-12-16T18:15:12Z</dc:date>
    <item>
      <title>I need something faster than count(distinct</title>
      <link>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225722#M77989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before anyone suggests anything, let me say that I CANNOT access the script.&lt;/P&gt;&lt;P&gt;I'm basically saying something like "count the number of customers that made a payment on an invoice that was due at least 365 days ago". The exact code I used is below. If I use the sum( and put 1 where [Customer Number] is, it will count customers that made multiple payments on 365+ day old invoices multiple times. I am running this on about 1 million customers so I need this to be as fast as possible. I have needed this for other more complicated calculations where the count(distinct made it so that it wouldn't calculate, so this would be very helpful.&lt;/P&gt;&lt;P&gt;=&lt;BR /&gt;count&lt;BR /&gt;(distinct /***This is really slow***/&lt;BR /&gt; aggr&lt;BR /&gt; (&lt;BR /&gt; if([Invoice Payment Date]&amp;gt;([Invoice Due Date]+365), /***If the payment was made over 1 year after the invoice was due***/&lt;BR /&gt; [Customer Number] /***I want the number of customers that made a payment after 1 year after their invoice was due***/&lt;BR /&gt; )&lt;BR /&gt; ,[Customer Number],[Invoice Number],[Invoice Payment Date] /***You'll just have to trust that I need all three of these***/&lt;BR /&gt; )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 16:44:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225722#M77989</guid>
      <dc:creator />
      <dc:date>2010-12-16T16:44:37Z</dc:date>
    </item>
    <item>
      <title>I need something faster than count(distinct</title>
      <link>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225723#M77990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, If statements are notoriously slow. Use Set Analysis:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;=count({&amp;lt;[Invoice Payment Date]={'&amp;gt;$(=Date([Invoice Due Date]+365))'}&amp;gt;}&lt;BR /&gt;distinct aggr([Customer Number]&lt;BR /&gt; ,[Customer Number],[Invoice Number],[Invoice Payment Date]&lt;BR /&gt; )&lt;BR /&gt;)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 17:03:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225723#M77990</guid>
      <dc:creator />
      <dc:date>2010-12-16T17:03:33Z</dc:date>
    </item>
    <item>
      <title>I need something faster than count(distinct</title>
      <link>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225724#M77991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sets are only calculated once per table and since the invoice due date changes for every customer and every invoice, this won't work. Correct me if I'm wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 17:05:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225724#M77991</guid>
      <dc:creator />
      <dc:date>2010-12-16T17:05:50Z</dc:date>
    </item>
    <item>
      <title>AW:Re: I need something faster than count(distinct</title>
      <link>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225725#M77992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you can enter a new field in your Table:&lt;/P&gt;&lt;P&gt;1 as Recordcounter&lt;/P&gt;&lt;P&gt;Then you can use Sum(Recordcounter ....)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 17:16:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225725#M77992</guid>
      <dc:creator>brenner_martina</dc:creator>
      <dc:date>2010-12-16T17:16:05Z</dc:date>
    </item>
    <item>
      <title>I need something faster than count(distinct</title>
      <link>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225726#M77993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are correct. I don't see any way to make that more effecient. You need to perform a million if statements, there isn't any way to make that fast. Flags would be an option, but you can't modify the load.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 18:15:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/I-need-something-faster-than-count-distinct/m-p/225726#M77993</guid>
      <dc:creator />
      <dc:date>2010-12-16T18:15:12Z</dc:date>
    </item>
  </channel>
</rss>

