<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/jive/rss" version="2.0">
  <channel>
    <title>Content in Tableau Community Forums</title>
    <link>/profile-content.jspa?filterID=contentstatus[published]&amp;targetUser=39152</link>
    <description>Recent content in Tableau Community Forums</description>
    <language>en</language>
    <pubDate>Fri, 20 Jun 2014 17:48:46 GMT</pubDate>
    <generator>Jive Engage 8.0.5.0  (http://jivesoftware.com/products/)</generator>
    <dc:date>2014-06-20T17:48:46Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Sum of count if "new"</title>
      <link>https://community.tableau.com/thread/144691</link>
      <description>&lt;!-- [DocumentBodyStart:369256be-fd54-4b83-bb33-9d06b2d19bf1] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;I'm attempting to get a total vs. new count of e-mail addresses, where "new" means "e-mail has not been on the list for the past year".&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;I have a data source table with dates and e-mail addresses. I&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;The dates are actually one per week, so I tried making a WINDOW_COUNT calculated field, which works only by e-mail address:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;IF COUNT([Email])=1 THEN &lt;/p&gt;&lt;p&gt; IF WINDOW_COUNT(COUNT([Email]),-51,-1)=0 &lt;/p&gt;&lt;p&gt;&amp;#160; THEN 1 &lt;/p&gt;&lt;p&gt;&amp;#160; END &lt;/p&gt;&lt;p&gt; END&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;That's my function - basically, if there's a value for this e-mail for the current column, and it doesn't appear in the previous 51 columns, then it should count as 1.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;This works, but it gives me either 1 or 0, depending on if the specific e-mail address is new that week. My Columns has DAY(date_field), Rows has email_field, and Marks has the calculated field above.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;What I really want is a sum - for each date, give me the total # of new e-mails. I know how to do the query I want in SQL, but I'm not quite there with Tableau. If it helps, the query is:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;select count(*) &lt;/p&gt;&lt;p&gt;from (select email,c_date from contributor_active &lt;/p&gt;&lt;p&gt;where c_date between $DATE - INTERVAL 1 YEAR and $DATE&lt;/p&gt;&lt;p&gt;group by email&lt;/p&gt;&lt;p&gt;having count(email) = 1 and c_date = $DATE) AS tbl;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;I could do this SQL query in my data source, but then I'd have to have 2 data sources if I wanted to show total vs. new on the same graph.&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:369256be-fd54-4b83-bb33-9d06b2d19bf1] --&gt;</description>
      <category domain="https://community.tableau.com/tags#/?containerType=14&amp;container=2003">group</category>
      <category domain="https://community.tableau.com/tags#/?containerType=14&amp;container=2003">sql</category>
      <category domain="https://community.tableau.com/tags#/?containerType=14&amp;container=2003">by</category>
      <category domain="https://community.tableau.com/tags#/?containerType=14&amp;container=2003">having</category>
      <pubDate>Fri, 20 Jun 2014 17:48:46 GMT</pubDate>
      <author>tableaucommunity@tableau.com</author>
      <guid>https://community.tableau.com/thread/144691</guid>
      <dc:date>2014-06-20T17:48:46Z</dc:date>
      <clearspace:dateToText>5 years 7 days ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
  </channel>
</rss>

