<?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 How to edit my search to get the total count of two search queries? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-total-count-of-two-search/m-p/277158#M83584</link>
    <description>&lt;P&gt;I have the following query which gives me a Total count of 2 searches but after evaluating, I am not getting the Total count. Please suggest something. In the end I need the Total count: suppose TotalA =7 and TotalB=10, so I need to display 17 in my dashboard.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=lts source="dbmon-tail://LTS_*" Track_Name = "*" |dedup  CreatedDateTime,Component_Id,Frequency_Mapping_Id|stats count(Track_Name) AS TotalA| append [ search index=lts source="dbmon-tail://  ||fillnull value=NULL Frequency_Mapping_Id  |dedup Component_Id,Frequency_Mapping_Id|stats count(Track_Name) AS TotalB]|eval Total= TotalA+TotalB |table Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 12 Dec 2016 12:05:44 GMT</pubDate>
    <dc:creator>shivendra_infy</dc:creator>
    <dc:date>2016-12-12T12:05:44Z</dc:date>
    <item>
      <title>How to edit my search to get the total count of two search queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-total-count-of-two-search/m-p/277158#M83584</link>
      <description>&lt;P&gt;I have the following query which gives me a Total count of 2 searches but after evaluating, I am not getting the Total count. Please suggest something. In the end I need the Total count: suppose TotalA =7 and TotalB=10, so I need to display 17 in my dashboard.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=lts source="dbmon-tail://LTS_*" Track_Name = "*" |dedup  CreatedDateTime,Component_Id,Frequency_Mapping_Id|stats count(Track_Name) AS TotalA| append [ search index=lts source="dbmon-tail://  ||fillnull value=NULL Frequency_Mapping_Id  |dedup Component_Id,Frequency_Mapping_Id|stats count(Track_Name) AS TotalB]|eval Total= TotalA+TotalB |table Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Dec 2016 12:05:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-total-count-of-two-search/m-p/277158#M83584</guid>
      <dc:creator>shivendra_infy</dc:creator>
      <dc:date>2016-12-12T12:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to get the total count of two search queries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-total-count-of-two-search/m-p/277159#M83585</link>
      <description>&lt;P&gt;The append adds results of two searches in row-by-row manner, hence when you'll get two rows (one from each search) with each row having only corresponding Total field available and other Total field will be null. (row1- TotalA has value, TotalB is null and so on). Thus when you calculate Total=TotalA+TotalB, it will be null as one operand is null. You should be using appendcols functions instead which adds search results column,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=lts source="dbmon-tail://LTS_*" Track_Name = "*" |dedup  CreatedDateTime,Component_Id,Frequency_Mapping_Id|stats count(Track_Name) AS TotalA| appendcols [ search index=lts source="dbmon-tail://  ||fillnull value=NULL Frequency_Mapping_Id  |dedup Component_Id,Frequency_Mapping_Id|stats count(Track_Name) AS TotalB]|eval Total= TotalA+TotalB |table Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Dec 2016 14:18:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-get-the-total-count-of-two-search/m-p/277159#M83585</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-12-12T14:18:05Z</dc:date>
    </item>
  </channel>
</rss>

