<?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: Passing dynamic value from stats to the remaining part of search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333141#M99064</link>
    <description>&lt;P&gt;Awesome.. This worked.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks a lot&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 06:19:36 GMT</pubDate>
    <dc:creator>k_harini</dc:creator>
    <dc:date>2017-10-31T06:19:36Z</dc:date>
    <item>
      <title>Passing dynamic value from stats to the remaining part of search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333137#M99060</link>
      <description>&lt;P&gt;I want to pass latest_date for null value so that inprogress count sits there as there is no completion date for inprogress records. Thats the ask. Here latest_date is not passed as token. Im just getting string latest date. is this doable? can some one help? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   index="test" IG="*"  |rename "Completion Date" as completed_date "Savings in k" as Dollar_Savings|eventstats last(completed_date) as latest_date|fillnull value=latest_date completed_date | stats count(eval(('Assessment Status'="Closed") OR ('Assessment Status'="Completed"))) as "# of Assessments completed (Projects)" sum(Dollar_Savings) as "Cost Savings Committed (K $)"  sum("FTE impact") as FTE_impact sum("Baseline FTE") as baseline_FTE count(eval('Assessment Status'="In Progress")) as "# of Assessments In-progress" by completed_date
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:28:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333137#M99060</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2020-09-29T16:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Passing dynamic value from stats to the remaining part of search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333138#M99061</link>
      <description>&lt;P&gt;I could do this by passing it as token from different query. Just want to know if it can be done in a single query instead of calling index twice&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 10:32:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333138#M99061</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2017-10-25T10:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Passing dynamic value from stats to the remaining part of search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333139#M99062</link>
      <description>&lt;P&gt;You can use the map command to pass on completed_date from base search to new search within same SPL.&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Map" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Map&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I however, feel eventstats is not required if you have your subsequent stats command return single result (since there is only one last(completed_date) as latest_date used as stats split by field. You even don't need the rename command and fillnull.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test" IG="*"  
| stats count(eval(('Assessment Status'="Closed") OR ('Assessment Status'="Completed"))) as "# of Assessments completed (Projects)" sum(Dollar_Savings) as "Cost Savings Committed (K $)"  sum("FTE impact") as FTE_impact sum("Baseline FTE") as baseline_FTE count(eval('Assessment Status'="In Progress")) as "# of Assessments In-progress" last("Completion Date") as latest_date
| map search="| makeresults  
| eval DateSelected=\"$latest_date$\""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You need to replace map SPL query with your own. Make sure all double quotes in inner query are escaped with backslash and use $latest_date$ value as token from the base search.&lt;BR /&gt;
Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:25:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333139#M99062</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T16:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Passing dynamic value from stats to the remaining part of search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333140#M99063</link>
      <description>&lt;P&gt;I believe what you want to do is replace the &lt;CODE&gt;fillnull&lt;/CODE&gt; portion with the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| eval completed_date=if(isnull(completed_date), latest_date, completed_date) | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The value X in &lt;CODE&gt;fillnull value=X&lt;/CODE&gt; is always treated as a string.  In your case, the string "latest_value".&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 19:45:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333140#M99063</guid>
      <dc:creator>khaynes_splunk</dc:creator>
      <dc:date>2017-10-25T19:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Passing dynamic value from stats to the remaining part of search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333141#M99064</link>
      <description>&lt;P&gt;Awesome.. This worked.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thanks a lot&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 06:19:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333141#M99064</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2017-10-31T06:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Passing dynamic value from stats to the remaining part of search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333142#M99065</link>
      <description>&lt;P&gt;Thanks for your time. I will try this.. &lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 06:19:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Passing-dynamic-value-from-stats-to-the-remaining-part-of-search/m-p/333142#M99065</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2017-10-31T06:19:55Z</dc:date>
    </item>
  </channel>
</rss>

