<?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 appendcols  not give proper answer in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190128#M54747</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;We used appendcols and hence write following query, but when we run following query then Overall counts get fine but the problem with Unique counts the appendcols function write data for overall but unique counts are blank.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="A1"  "test " | eval CompletedCt = "Overall" | stats count(userID) As Heats by Date,CompletedCt,Flow| appendcols [search sourcetype="A1"  "test1" Completed | eval CompletedCt = "Overall" | stats count(UserId) As Completed by Date,CompletedCt,Flow]  | APPEND [search sourcetype="A1"  "test" | eval CompletedCt = "Unique" | stats dc(UserID) As Heatsby Date,CompletedCt,Flow] | appendcols [search sourcetype="A1"  "test" Completed | eval CompletedCt = "Unique" | stats dc(UserID) As Completed by Date,CompletedCt,Flow ] | table Date,CompletedCt,IdRecMethod,Attempt,Completed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please help me out.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Sandeep Thosar&lt;/P&gt;</description>
    <pubDate>Mon, 18 May 2015 13:58:15 GMT</pubDate>
    <dc:creator>sandeep_thosar</dc:creator>
    <dc:date>2015-05-18T13:58:15Z</dc:date>
    <item>
      <title>appendcols  not give proper answer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190128#M54747</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;

&lt;P&gt;We used appendcols and hence write following query, but when we run following query then Overall counts get fine but the problem with Unique counts the appendcols function write data for overall but unique counts are blank.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="A1"  "test " | eval CompletedCt = "Overall" | stats count(userID) As Heats by Date,CompletedCt,Flow| appendcols [search sourcetype="A1"  "test1" Completed | eval CompletedCt = "Overall" | stats count(UserId) As Completed by Date,CompletedCt,Flow]  | APPEND [search sourcetype="A1"  "test" | eval CompletedCt = "Unique" | stats dc(UserID) As Heatsby Date,CompletedCt,Flow] | appendcols [search sourcetype="A1"  "test" Completed | eval CompletedCt = "Unique" | stats dc(UserID) As Completed by Date,CompletedCt,Flow ] | table Date,CompletedCt,IdRecMethod,Attempt,Completed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please help me out.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Sandeep Thosar&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 13:58:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190128#M54747</guid>
      <dc:creator>sandeep_thosar</dc:creator>
      <dc:date>2015-05-18T13:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: appendcols  not give proper answer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190129#M54748</link>
      <description>&lt;P&gt;The problem is with the way you have written your query. You need to nest the appendcols inside of the append, otherwise Splunk will treat it as an appendcols for the full query up to that point.&lt;/P&gt;

&lt;P&gt;However there is a better solution. Extract the "Completed" into a field, name it Status if you will:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype="A1" "test " &lt;BR /&gt;
| stats count As OverallHeats &lt;BR /&gt;
        count(eval(Status=="Completed")) as OverallCompleted &lt;BR /&gt;
        dc(userID) as UniqueHeats &lt;BR /&gt;
by Date,CompletedCt,Flow &lt;BR /&gt;
| appendcols [search sourcetype="A1" "test " "Completed"&lt;BR /&gt;
    | stats dc(userID) as UniqueCompleted &lt;BR /&gt;
     by Date,CompletedCt,Flow ]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;OR without extracting "Completed" into a field:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype="A1" "test " &lt;BR /&gt;
| stats count As OverallHeats &lt;BR /&gt;
        dc(userID) as UniqueHeats &lt;BR /&gt;
by Date,CompletedCt,Flow &lt;BR /&gt;
| appendcols [search sourcetype="A1" "test " "Completed"&lt;BR /&gt;
    | stats count as OverallCompleted &lt;BR /&gt;
            dc(userID) as UniqueCompleted &lt;BR /&gt;
     by Date,CompletedCt,Flow ]&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 17:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190129#M54748</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2015-05-18T17:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: appendcols  not give proper answer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190130#M54749</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Thanks for the prompt reply. i have tried your solution but anable to write netsed appendcols. Please send me sample exmaple for nested appendcols if possible. and also need to show unique and overall counts seperately. need following output.&lt;/P&gt;

&lt;P&gt;Date                  Unique/Overall         Flow               heats           Completed&lt;BR /&gt;
2015-05-17          overall                    Flow1               20                   30&lt;BR /&gt;
2015-05-17          overall                    Flow2               50                   40&lt;BR /&gt;
2015-05-17          Unique                  Flow1               20                   30&lt;BR /&gt;
2015-05-17         Unique                   Flow2               50                   40&lt;/P&gt;

&lt;P&gt;But i have getting following output&lt;/P&gt;

&lt;P&gt;Date                  Unique/Overall         Flow               heats           Completed&lt;BR /&gt;
2015-05-17          overall                    Flow1               20                   30&lt;BR /&gt;
2015-05-17          overall                    Flow2               50                   40&lt;BR /&gt;
2015-05-17          Unique                  Flow1               20&lt;BR /&gt;&lt;BR /&gt;
2015-05-17         Unique                   Flow2               50                  &lt;/P&gt;

&lt;P&gt;Please help me out.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Sandeep&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2015 07:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190130#M54749</guid>
      <dc:creator>sandeep_thosar</dc:creator>
      <dc:date>2015-05-19T07:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: appendcols  not give proper answer</title>
      <link>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190131#M54750</link>
      <description>&lt;P&gt;This should do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="A1"  "test " | eval CompletedCt = "Overall" | stats count(userID) As Heats by Date,CompletedCt,Flow| appendcols [search sourcetype="A1"  "test1" Completed | eval CompletedCt = "Overall" | stats count(UserId) As Completed by Date,CompletedCt,Flow]  | APPEND [search sourcetype="A1"  "test" | eval CompletedCt = "Unique" | stats dc(UserID) As Heatsby Date,CompletedCt,Flow | appendcols [search sourcetype="A1"  "test" Completed | eval CompletedCt = "Unique" | stats dc(UserID) As Completed by Date,CompletedCt,Flow ]] | table Date,CompletedCt,IdRecMethod,Attempt,Completed
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 May 2015 17:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/appendcols-not-give-proper-answer/m-p/190131#M54750</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2015-05-20T17:12:15Z</dc:date>
    </item>
  </channel>
</rss>

