<?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: Errors on Count Key Field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Errors-on-Count-Key-Field/m-p/1058356#M937752</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't use count() on a key field. Qlikview won't know which table should be used to count the values. If you want to know the distinct number of InvoiceID values then use count(distinct InvoiceID). That will always return the same result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Feb 2016 17:51:34 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2016-02-05T17:51:34Z</dc:date>
    <item>
      <title>Errors on Count Key Field</title>
      <link>https://community.qlik.com/t5/QlikView/Errors-on-Count-Key-Field/m-p/1058355#M937751</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;I have the the script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Invoice:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number of rows 413, InvoiceId has distinct values from 1 to 413&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerId,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InvoiceDate as Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InvoiceId;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM Invoice;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;InvoiceLine:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number of rows 2241, InvoiceId has repeted values&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;LOAD InvoiceId,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InvoiceLineId,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Quantity,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TrackId,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UnitPrice;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM InvoiceLine;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a text object wjth expression:&amp;nbsp; =count(InvoiceId) and I had the result 2241.&amp;nbsp; (I understand why, no problem).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Under InvoiceLine table I inserted the script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Concatenate (Invoice)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;LOAD CustomerId, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SupportRepId, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Budget, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; makedate(Year,1,1) as Date&lt;/P&gt;&lt;P&gt;FROM ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then the result was 413. I don't understand, I expected was 2241.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I have loaded InvoiceLine before Invoice and the the result was 2241.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why this behavior?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Someone can explain why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Feb 2016 10:06:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Errors-on-Count-Key-Field/m-p/1058355#M937751</guid>
      <dc:creator />
      <dc:date>2016-02-05T10:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Errors on Count Key Field</title>
      <link>https://community.qlik.com/t5/QlikView/Errors-on-Count-Key-Field/m-p/1058356#M937752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't use count() on a key field. Qlikview won't know which table should be used to count the values. If you want to know the distinct number of InvoiceID values then use count(distinct InvoiceID). That will always return the same result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Feb 2016 17:51:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Errors-on-Count-Key-Field/m-p/1058356#M937752</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-02-05T17:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Errors on Count Key Field</title>
      <link>https://community.qlik.com/t5/QlikView/Errors-on-Count-Key-Field/m-p/1058357#M937753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Feb 2016 13:06:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Errors-on-Count-Key-Field/m-p/1058357#M937753</guid>
      <dc:creator />
      <dc:date>2016-02-08T13:06:14Z</dc:date>
    </item>
  </channel>
</rss>

