<?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: Stats Distint Count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243175#M72388</link>
    <description>&lt;P&gt;Hi, thank you for taking the time to reply to my post.&lt;/P&gt;

&lt;P&gt;I did try the solution you kindly provided, but unfortunately it didn't return any results, but I have managed to put together a solution.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Wed, 16 Mar 2016 15:26:15 GMT</pubDate>
    <dc:creator>IRHM73</dc:creator>
    <dc:date>2016-03-16T15:26:15Z</dc:date>
    <item>
      <title>Stats Distint Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243172#M72385</link>
      <description>&lt;P&gt;Hi, I wonder whether someone may be able to help me please.&lt;/P&gt;

&lt;P&gt;I'm using the query below to extract a piece of data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main tags.transactionName=print-suppression
    | eval Date=substr(generatedAt, 1, 10) | stats dc(Date) by Date
    | eval verifiedButBounced=coalesce('detail.verifiedButBounced.count',0)
    | eval pendingVerificationOfChangedEmail=coalesce('detail.pendingVerificationOfChangedEmail.count', 0)
    | eval verifiedPendingVerificationOfChangedEmailAndBounced=coalesce('detail.verifiedPendingVerificationOfChangedEmailAndBounced.count', 0)
    | eval verifiedButBouncedPendingVerificationOfChangedEmail=coalesce('detail.verifiedButBouncedPendingVerificationOfChangedEmail.count', 0)
    | eval verifiedButBouncedPendingVerificationOfChangedEmailAndBounced=coalesce('detail.verifiedButBouncedPendingVerificationOfChangedEmailAndBounced.count', 0)
    | eval verifiedNotBounced=coalesce('detail.verifiedNotBounced.count', 0)
    | eval Verified=verifiedButBounced + pendingVerificationOfChangedEmail +  verifiedPendingVerificationOfChangedEmailAndBounced + verifiedButBouncedPendingVerificationOfChangedEmail + verifiedButBouncedPendingVerificationOfChangedEmailAndBounced + verifiedNotBounced
    | rename detail.totalOfAllOptedIn.count AS Opted_In, detail.optedOut.count AS Opted_Out 
    | table Date, Opted_In, Opted_Out, Verified, detail.verifiedButBounced.count, detail.verifiedNotBounced.count, detail.pendingVerificationOfChangedEmail
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem I have is that I want eliminate duplicate dates. Now I know that I can use 'dedup' which successfully removes the duplicates but I've been reading that stats dc or 'distinct count' is more efficient, but I'm a little unsure about how to incorporate this.&lt;/P&gt;

&lt;P&gt;I just wondered whether someone could possibly look at this please and offer some guidance on where I should incorporate the 'stats dc' command.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 14:20:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243172#M72385</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-03-16T14:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Distint Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243173#M72386</link>
      <description>&lt;P&gt;You could do it at the tail end of that search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;that_Search&amp;gt; | stats last(*) as * by Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will take the "last" of each value on each date, and output it. You can also use "first" to get the first event found.&lt;/P&gt;

&lt;P&gt;Remove the &lt;CODE&gt;|stats dc(Date) by Date&lt;/CODE&gt;, since that is probably interfering with the search.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 15:14:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243173#M72386</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2016-03-16T15:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Distint Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243174#M72387</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;Just to let you know that I've continued to work on this and created a solution here:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main tags.transactionName=print-suppression
| eval Date=substr(generatedAt, 1, 10)
| eval verifiedButBounced=coalesce('detail.verifiedButBounced.count',0)
| eval pendingVerificationOfChangedEmail=coalesce('detail.pendingVerificationOfChangedEmail.count', 0)
| eval verifiedPendingVerificationOfChangedEmailAndBounced=coalesce('detail.verifiedPendingVerificationOfChangedEmailAndBounced.count', 0)
| eval verifiedButBouncedPendingVerificationOfChangedEmail=coalesce('detail.verifiedButBouncedPendingVerificationOfChangedEmail.count', 0)
| eval verifiedButBouncedPendingVerificationOfChangedEmailAndBounced=coalesce('detail.verifiedButBouncedPendingVerificationOfChangedEmailAndBounced.count', 0)
| eval verifiedNotBounced=coalesce('detail.verifiedNotBounced.count', 0)
| eval Verified=verifiedButBounced + pendingVerificationOfChangedEmail +  verifiedPendingVerificationOfChangedEmailAndBounced + verifiedButBouncedPendingVerificationOfChangedEmail + verifiedButBouncedPendingVerificationOfChangedEmailAndBounced + verifiedNotBounced
| stats dc(Date) by Date, Verified, detail.totalOfAllOptedIn.count, detail.optedOut.count, detail.verifiedButBounced.count, detail.verifiedNotBounced.count, detail.pendingVerificationOfChangedEmail.count
| rename detail.totalOfAllOptedIn.count AS Opted_In, detail.optedOut.count AS Opted_Out 
| table Date, Opted_In, Opted_Out, Verified, detail.verifiedButBounced.count, detail.verifiedNotBounced.count, detail.pendingVerificationOfChangedEmail.count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 15:24:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243174#M72387</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-03-16T15:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Distint Count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243175#M72388</link>
      <description>&lt;P&gt;Hi, thank you for taking the time to reply to my post.&lt;/P&gt;

&lt;P&gt;I did try the solution you kindly provided, but unfortunately it didn't return any results, but I have managed to put together a solution.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 15:26:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Distint-Count/m-p/243175#M72388</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-03-16T15:26:15Z</dc:date>
    </item>
  </channel>
</rss>

