<?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: distinct count in data preparation in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/distinct-count-in-data-preparation/m-p/272000#M4297</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that the problem is your group sentence, since you are grouping by employee id and name, is counting diferents pairs of id and names. Since your names and id's don't have bijection, there are four observations on each year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you like to count group by employee id use the following code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table results as(
		select count(distinct employee_id) as count, Year
		from _data_
		group by year
	);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2016 14:52:30 GMT</pubDate>
    <dc:creator>arodriguez</dc:creator>
    <dc:date>2016-05-20T14:52:30Z</dc:date>
    <item>
      <title>distinct count in data preparation</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/distinct-count-in-data-preparation/m-p/271657#M4269</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to seek your help regarding distinct count in Data Preparation. Our requirements is to get the distinct count of employee id per year however the employee name is not unique but we need to display the employee name in the info window link as drill-through but in the main graph we should get the distinct employee count.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried below expression in data preparation no error but got incorrect result&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;expression:&lt;/STRONG&gt;&amp;nbsp;distinct(employee id)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;aggregation:&lt;/STRONG&gt; group by employee id, group by year, Employee Name has blank aggregation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see below sample data. In below data the correct result should be 2013 = 2 employee id, 2014 = 3 but in my result which is wrong 2013=4 and 2014=4. Please help. Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3233i22921FBC90B162FF/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="distinct count.JPG" title="distinct count.JPG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Carrot17&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 09:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/distinct-count-in-data-preparation/m-p/271657#M4269</guid>
      <dc:creator>Carrot17</dc:creator>
      <dc:date>2016-05-19T09:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: distinct count in data preparation</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/distinct-count-in-data-preparation/m-p/272000#M4297</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that the problem is your group sentence, since you are grouping by employee id and name, is counting diferents pairs of id and names. Since your names and id's don't have bijection, there are four observations on each year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you like to count group by employee id use the following code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table results as(
		select count(distinct employee_id) as count, Year
		from _data_
		group by year
	);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 14:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/distinct-count-in-data-preparation/m-p/272000#M4297</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2016-05-20T14:52:30Z</dc:date>
    </item>
  </channel>
</rss>

