<?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: Join two queries in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485243#M135793</link>
    <description>&lt;P&gt;Hi @tahasefiani,&lt;BR /&gt;
Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery" 
| where (strftime(_time, "%Y-%m-%d") &amp;gt;= "2020-02-27") AND (strftime(_time, "%Y-%m-%d") &amp;lt;= "2020-03-03") 
| stats dc(eval(if(STEP="Click",ID_MESSAGE,NULL))) AS click by ID_MESSAGE 
| timechart span=1d sum(click) AS click 
| eval sent= 
    [| loadjob savedsearch="myquery" 
    | where (strftime(_time, "%Y-%m-%d") = "2020-02-27") 
    | stats dc(eval(if(STEP="Sent",ID_MESSAGE,NULL))) AS sent by ID_MESSAGE 
    | stats sum(sent) AS sent 
    | return $sent] 
| eval RME= 
    [| loadjob savedsearch="myquery" 
    | where (strftime(_time, "%Y-%m-%d") = "2020-02-27") 
    | stats dc(eval(if(STEP="RME",ID_MESSAGE,NULL))) AS RME by ID_MESSAGE 
    | stats sum(RME) AS RME 
    | return $RME] 
| eval the_rest=sent-(RME+click)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Mar 2020 15:49:25 GMT</pubDate>
    <dc:creator>manjunathmeti</dc:creator>
    <dc:date>2020-03-03T15:49:25Z</dc:date>
    <item>
      <title>Join two queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485242#M135792</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;i Have this query that i want to improve&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery"
| where (strftime(_time, "%Y-%m-%d") = "2020-02-27")
|  stats dc(eval(if(STEP="Sent",ID_MESSAGE,NULL))) AS sent,
    dc(eval(if(STEP="RME",ID_MESSAGE,NULL))) AS RME by ID_MESSAGE 
| join type=left ID_MESSAGE [| loadjob savedsearch="myquery" 
| where (strftime(_time, "%Y-%m-%d") &amp;gt;= "2020-02-27") AND (strftime(_time, "%Y-%m-%d") &amp;lt;= "2020-03-03") 
|stats dc(eval(if(STEP="Click",ID_MESSAGE,NULL))) AS click by ID_MESSAGE]
|where sent&amp;gt;0
|stats sum(sent) AS sent,sum(RME) AS RME,sum(click) AS click
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is the result that i have today&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8476i9D8E281BF9385F6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;And this is the result that i want to have &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8477i49360F4ED9BE274B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;knowing that RME  and click are calculated on the ID_MESSAGE sent&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 14:42:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485242#M135792</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-03-03T14:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Join two queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485243#M135793</link>
      <description>&lt;P&gt;Hi @tahasefiani,&lt;BR /&gt;
Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery" 
| where (strftime(_time, "%Y-%m-%d") &amp;gt;= "2020-02-27") AND (strftime(_time, "%Y-%m-%d") &amp;lt;= "2020-03-03") 
| stats dc(eval(if(STEP="Click",ID_MESSAGE,NULL))) AS click by ID_MESSAGE 
| timechart span=1d sum(click) AS click 
| eval sent= 
    [| loadjob savedsearch="myquery" 
    | where (strftime(_time, "%Y-%m-%d") = "2020-02-27") 
    | stats dc(eval(if(STEP="Sent",ID_MESSAGE,NULL))) AS sent by ID_MESSAGE 
    | stats sum(sent) AS sent 
    | return $sent] 
| eval RME= 
    [| loadjob savedsearch="myquery" 
    | where (strftime(_time, "%Y-%m-%d") = "2020-02-27") 
    | stats dc(eval(if(STEP="RME",ID_MESSAGE,NULL))) AS RME by ID_MESSAGE 
    | stats sum(RME) AS RME 
    | return $RME] 
| eval the_rest=sent-(RME+click)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Mar 2020 15:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485243#M135793</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-03T15:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Join two queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485244#M135794</link>
      <description>&lt;P&gt;UPDATE2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery" 
| where (strftime(_time, "%Y-%m-%d") &amp;gt;= "2020-02-27") AND (strftime(_time, "%Y-%m-%d") &amp;lt;= "2020-03-03") 
| bin span=1d _time
| stats dc(eval(STEP="Sent" AND strftime(_time,"%F")="2020-02-27")) AS sent
, dc(eval(STEP="RME" AND strftime(_time,"%F")="2020-02-27")) AS RME
, dc(eval(STEP="Click")) AS click by _time ID_MESSAGE 
| search ID_MESSAGE="ABC" OR ID_MESSAGE="XYZ"
| fields - ID_MESSAGE
| stats sum(*) as * by _time
| eval The_rest=sent + RME - click
| streamstats sum(The_rest) as "The rest"
| table _time  sent RME click "The rest"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure the logs and recently query still&lt;BR /&gt;
now.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 20:06:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485244#M135794</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-03T20:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Join two queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485245#M135795</link>
      <description>&lt;P&gt;Thanks @manjunathmeti &lt;BR /&gt;
But there is a problem in your query! The result which I want on "click" and "RME", it's always on ID_MESSAGE recover in "sent" of 27/02/2020. And besides that is why I had used the join in my query.&lt;/P&gt;

&lt;P&gt;Example: Admitting that we have "XYZ" and "WVT" as ID_MESSAGE on "sent"&lt;BR /&gt;
The search in "click" and "RME" must be on "XYZ", "WVT"&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 08:29:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485245#M135795</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-03-04T08:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Join two queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485246#M135796</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery" 
| where (strftime(_time, "%Y-%m-%d") &amp;gt;= "2020-02-27") AND (strftime(_time, "%Y-%m-%d") &amp;lt;= "2020-03-03") 
| stats dc(eval(if(STEP="Click",ID_MESSAGE,NULL))) AS click by ID_MESSAGE 
| timechart span=1d sum(click) AS click by ID_MESSAGE
| join type=left ID_MESSAGE 
     [| loadjob savedsearch="myquery" 
     | where (strftime(_time, "%Y-%m-%d") = "2020-02-27") 
     | stats dc(eval(if(STEP="Sent",ID_MESSAGE,NULL))) AS sent, dc(eval(if(STEP="RME",ID_MESSAGE,NULL))) AS RME by ID_MESSAGE 
     | stats sum(sent) AS sent, sum(RME) AS RME by ID_MESSAGE]
| eval the_rest=sent-(RME+click)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Mar 2020 08:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485246#M135796</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-04T08:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Join two queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485247#M135797</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;  I added a timechart and sum, this is what i have as result &lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/284651-splunkanswer.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;For sent and RME  ,i want only ther distinct count of ID_MESSAGE of the 27.&lt;BR /&gt;
But for click I want distinct count of the ID_MESSAGE(that we have counted on sent) from 27 to 03/03.&lt;BR /&gt;
The rest is like a countdown of sent&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:28:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485247#M135797</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-09-30T04:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Join two queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485248#M135798</link>
      <description>&lt;P&gt;I see, the answers is updated.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 22:08:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485248#M135798</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-04T22:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Join two queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485249#M135799</link>
      <description>&lt;P&gt;@to4kawa It's not really what i want to do.&lt;BR /&gt;
There is an explication of what i have today as result and what i want to do &lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8475i54F87A1EEB595BAC/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;@manjunathmeti &lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 09:33:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-two-queries/m-p/485249#M135799</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-03-05T09:33:03Z</dc:date>
    </item>
  </channel>
</rss>

