<?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 calculate -90 day and - 1 day if i pass date from time picker dynamically ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274806#M82890</link>
    <description>&lt;P&gt;kindly some one help pls.&lt;/P&gt;

&lt;P&gt;For the above question i use this approch.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval early_date=""$timeinv.earliest$""    
| eval yest1 = relative_time(""$timeinv.earliest$"", "-1d@d" )  
| eval days90_ago1 = relative_time(""$timeinv.earliest$"", "-90d@d" )  
| eval yest=strftime(yest1, "%Y-%m-%d")    
| eval days90_ago=strftime(days90_ago1, "%Y-%m-%d") 
| eval R_recon_business_date=substr(recon_business_date,1,10)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there any-other approach to achieve it. above mentioned approach is very slow.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2016 18:30:10 GMT</pubDate>
    <dc:creator>shankarananthth</dc:creator>
    <dc:date>2016-05-27T18:30:10Z</dc:date>
    <item>
      <title>how to calculate -90 day and - 1 day if i pass date from time picker dynamically ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274806#M82890</link>
      <description>&lt;P&gt;kindly some one help pls.&lt;/P&gt;

&lt;P&gt;For the above question i use this approch.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval early_date=""$timeinv.earliest$""    
| eval yest1 = relative_time(""$timeinv.earliest$"", "-1d@d" )  
| eval days90_ago1 = relative_time(""$timeinv.earliest$"", "-90d@d" )  
| eval yest=strftime(yest1, "%Y-%m-%d")    
| eval days90_ago=strftime(days90_ago1, "%Y-%m-%d") 
| eval R_recon_business_date=substr(recon_business_date,1,10)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there any-other approach to achieve it. above mentioned approach is very slow.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 18:30:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274806#M82890</guid>
      <dc:creator>shankarananthth</dc:creator>
      <dc:date>2016-05-27T18:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate -90 day and - 1 day if i pass date from time picker dynamically ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274807#M82891</link>
      <description>&lt;P&gt;Are you trying to add few columns (yest and days90_ago) into your search OR just generating those values to be displayed ?? Could you provide you full search so that we can know the context?&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 18:56:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274807#M82891</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-27T18:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate -90 day and - 1 day if i pass date from time picker dynamically ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274808#M82892</link>
      <description>&lt;P&gt;im trying to generate a date colume -90 days and -1 day  with the dynamic value passed from time picker . later i will use those two date fields in filter again like same provide below.&lt;/P&gt;

&lt;P&gt;| where R_recon_business_date &amp;gt;= days90_ago  AND R_recon_business_date &amp;lt;= yest &lt;/P&gt;

&lt;P&gt;Thanks in advance..&lt;/P&gt;

&lt;P&gt;This is the sample query framed ..&lt;/P&gt;

&lt;P&gt;index=data_for_checkprod&lt;BR /&gt;&lt;BR /&gt;
 | rename currency_val as currency_code&lt;BR /&gt;&lt;BR /&gt;
 | join type=left currency_code [search index=currenciesss]&lt;BR /&gt;&lt;BR /&gt;
 | eval a= (-txn_amount/100)  &lt;/P&gt;

&lt;P&gt;| eval start_date="1464235200"&lt;BR /&gt;&lt;BR /&gt;
 | eval day_bef = relative_time("1464235200", "-1d@d" )&lt;BR /&gt;&lt;BR /&gt;
 | eval 90days_ago = relative_time("1464235200", "-90d@d" )&lt;BR /&gt;&lt;BR /&gt;
 | eval yesterday=strftime(day_bef, "%Y-%m-%d")&lt;BR /&gt;&lt;BR /&gt;
 | eval ago_90days=strftime(90days_ago, "%Y-%m-%d") &lt;BR /&gt;
 | eval R_re_bis_date=substr(recon_business_date,1,10)&lt;BR /&gt;
 | where R_re_bis_date &amp;gt;= ago_90days  AND R_re_bis_date &amp;lt;= yesterday&lt;BR /&gt;
 | where (like(ID, "FI72%") OR like(ID, "FI80%") OR msg ="0200" OR msg ="0420" OR tran_type = "01" )&lt;BR /&gt;
  AND pos_origin="true" &lt;/P&gt;

&lt;P&gt;| stats sum(a) as show_data by R_re_bis_date, ID, code&lt;BR /&gt;
 | table R_re_bis_date ,ID,code,show_data&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:49:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274808#M82892</guid>
      <dc:creator>shankarananthth</dc:creator>
      <dc:date>2020-09-29T09:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate -90 day and - 1 day if i pass date from time picker dynamically ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274809#M82893</link>
      <description>&lt;P&gt;If your answer gives you what you need (only you can say), then that is all there is to it.  There is no quicker way to do what you have shown.  Furthermore, there should be nothing "slow" about it.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 20:04:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-90-day-and-1-day-if-i-pass-date-from-time/m-p/274809#M82893</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-05-27T20:04:12Z</dc:date>
    </item>
  </channel>
</rss>

