<?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 Problem with Distinct Count function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-Distinct-Count-function/m-p/229500#M81399</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your if() returns 0, and count(distinct 0) = 1.&lt;/P&gt;&lt;P&gt;Replace "0" by null() and it will work as expected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 May 2010 10:49:11 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2010-05-01T10:49:11Z</dc:date>
    <item>
      <title>Problem with Distinct Count function</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Distinct-Count-function/m-p/229499#M81398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Folks,&lt;/P&gt;&lt;P&gt;I have a simple problem, but having spent hours lookign at it I can't seem to fix it but I am sure it is something obvious.&lt;/P&gt;&lt;P&gt;I have some staff data, containing First_Name, Last_Name, Assignment_Number, VIR_Date, Hire_Date, VIR_Number&lt;/P&gt;&lt;P&gt;I have shown a sample below, I am seeking to categorise staff based on a count of VIRs based on the Length of Service (VIR_Date - Hire_Date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" bordercolor="#DCDCDC" cellpadding="2" cellspacing="1" width="509"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#EBEBEB" height="16" width="23%"&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold; text-align: left"&gt;ASSIGNMENT_NUMBER&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#EBEBEB" height="16" width="17%"&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold; text-align: left"&gt;FIRST_NAME&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#EBEBEB" height="16" width="16%"&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold; text-align: left"&gt;LAST_NAME&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#EBEBEB" height="16" width="14%"&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold; text-align: left"&gt;Hire Date&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#EBEBEB" height="16" width="14%"&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold; text-align: left"&gt;VIR_Date&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#EBEBEB" height="16" width="16%"&gt;&lt;B&gt;&lt;/B&gt;&lt;P style="font-weight: bold; text-align: left"&gt;VIR_Number&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD bgcolor="white" height="16" width="23%"&gt;&lt;P style="text-align: right"&gt;4508976&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="17%"&gt;&lt;P style="text-align: left"&gt;Jim&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="16%"&gt;&lt;P style="text-align: left"&gt;Smith&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="14%"&gt;&lt;P style="text-align: right"&gt;31/05/2005&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="14%"&gt;&lt;P style="text-align: right"&gt;30/03/2010&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="16%"&gt;&lt;P style="text-align: left"&gt;HT090674&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD bgcolor="#F5F5F5" height="16" width="23%"&gt;&lt;P style="text-align: right"&gt;4508976&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#F5F5F5" height="16" width="17%"&gt;&lt;P style="text-align: left"&gt;Jim&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#F5F5F5" height="16" width="16%"&gt;&lt;P style="text-align: left"&gt;Smith&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#F5F5F5" height="16" width="14%"&gt;&lt;P style="text-align: right"&gt;31/05/2005&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#F5F5F5" height="16" width="14%"&gt;&lt;P style="text-align: right"&gt;08/04/2010&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="#F5F5F5" height="16" width="16%"&gt;&lt;P style="text-align: left"&gt;HT090710&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD bgcolor="white" height="16" width="23%"&gt;&lt;P style="text-align: right"&gt;4508976&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="17%"&gt;&lt;P style="text-align: left"&gt;Jim&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="16%"&gt;&lt;P style="text-align: left"&gt;Smith&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="14%"&gt;&lt;P style="text-align: right"&gt;31/05/2005&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="14%"&gt;&lt;P style="text-align: right"&gt;21/04/2010&lt;/P&gt;&lt;P style="text-align: right"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD bgcolor="white" height="16" width="16%"&gt;&lt;P style="text-align: left"&gt;HT090721&lt;/P&gt;&lt;P style="text-align: left"&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;My formala for the example is below, essentially I am trying to count the number of unique VIRs where the Length of Service (V.I.R_Date - Hire Date) is less than 2,which should equal ZERO but for some reason the formula keeps giving me 1 :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=(&lt;/P&gt;&lt;P&gt;count(distinct if ( ((Date-[Hire Date])/365)&amp;lt;=2,[V.I.R. Number],0)))&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Thanks in advance for your help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 May 2010 08:03:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Distinct-Count-function/m-p/229499#M81398</guid>
      <dc:creator />
      <dc:date>2010-05-01T08:03:43Z</dc:date>
    </item>
    <item>
      <title>Problem with Distinct Count function</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Distinct-Count-function/m-p/229500#M81399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your if() returns 0, and count(distinct 0) = 1.&lt;/P&gt;&lt;P&gt;Replace "0" by null() and it will work as expected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 May 2010 10:49:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Distinct-Count-function/m-p/229500#M81399</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2010-05-01T10:49:11Z</dc:date>
    </item>
    <item>
      <title>Problem with Distinct Count function</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Distinct-Count-function/m-p/229501#M81400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Oleg, that worked for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 May 2010 20:51:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Distinct-Count-function/m-p/229501#M81400</guid>
      <dc:creator />
      <dc:date>2010-05-01T20:51:07Z</dc:date>
    </item>
  </channel>
</rss>

