<?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: How to use two queries in one? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-two-queries-in-one/m-p/497103#M138463</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;| where (strftime(_time, "%Y-%m-%d") &amp;gt;= FromDate) AND (strftime(_time, "%Y-%m-%d") &amp;lt;= ToDate)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is this query really work?&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jan 2020 13:47:55 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-01-28T13:47:55Z</dc:date>
    <item>
      <title>How to use two queries in one?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-two-queries-in-one/m-p/497102#M138462</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Today i have this query in my dashboard :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery"
 |eval FromDate = "2020-01-23"
 |eval ToDate = "2020-01-23"
 | eval ToDateexpir = strptime("2020-01-23", "%Y-%m-%d")
 | eval expiring = ToDate + 86400*4
 | eval expiring = strftime(expiring, "%Y-%m-%d")
 | where (strftime(_time, "%Y-%m-%d") &amp;gt;= FromDate) AND (strftime(_time, "%Y-%m-%d") &amp;lt;= ToDate)
 | stats count(eval(if(MESSAGE="show",STEP,NULL))) AS showed,
 count(eval(if(MESSAGE="send",STEP,NULL))) AS sent,
 count(eval(if(MESSAGE="delete",STEP,NULL))) AS deleted by client |where showed&amp;gt;0
 |stats sum(showed) AS showed,sum(sent) AS sent,sum(deleted) AS deleted
 | eval AVG= round(((showed - (sent+deleted))/showed*100),2)." %"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to keep the same query and logic, but for the calculation of the fields "sent" i want it to be from "FromDate" to "expiring"&lt;BR /&gt;
Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 13:20:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-two-queries-in-one/m-p/497102#M138462</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-01-28T13:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use two queries in one?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-two-queries-in-one/m-p/497103#M138463</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| where (strftime(_time, "%Y-%m-%d") &amp;gt;= FromDate) AND (strftime(_time, "%Y-%m-%d") &amp;lt;= ToDate)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is this query really work?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 13:47:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-two-queries-in-one/m-p/497103#M138463</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-28T13:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use two queries in one?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-two-queries-in-one/m-p/497104#M138464</link>
      <description>&lt;P&gt;| loadjob savedsearch="myquery"&lt;BR /&gt;
      |eval FromDate = "2020-01-23"&lt;BR /&gt;
  |eval ToDate = "2020-01-23"&lt;BR /&gt;
  | eval ToDateexpir = strptime("2020-01-23", "%Y-%m-%d")&lt;BR /&gt;
           | eval expiring = ToDate  + 86400*4&lt;BR /&gt;
           | eval expiring = strftime(expiring, "%Y-%m-%d")&lt;BR /&gt;
          | where (strftime(_time, "%Y-%m-%d") &amp;gt;= FromDate) AND (strftime(_time, "%Y-%m-%d") &amp;lt;= ToDate)&lt;BR /&gt;
          | stats count(eval(if(MESSAGE="show",STEP,NULL))) AS showed,&lt;BR /&gt;
          count(eval(if(MESSAGE="send",STEP,NULL))) AS sent,&lt;BR /&gt;
          count(eval(if(MESSAGE="delete",STEP,NULL))) AS deleted by client |where showed&amp;gt;0&lt;BR /&gt;
           |stats sum(showed) AS showed,sum(sent) AS sent,sum(deleted) AS deleted&lt;BR /&gt;
         | eval AVG= round(((showed - (sent+deleted))/showed*100),2)." %"&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:55:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-two-queries-in-one/m-p/497104#M138464</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-09-30T03:55:58Z</dc:date>
    </item>
  </channel>
</rss>

