<?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 extract and calculate the sum of a field from different searches? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271128#M81627</link>
    <description>&lt;P&gt;@papermalik - Did the comment provided by somesoni provide a solution to your question? If yes, please let me know so that I can convert it to an Answer to close out your question. If no, please leave a comment with more feedback. Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2017 01:12:29 GMT</pubDate>
    <dc:creator>aaraneta_splunk</dc:creator>
    <dc:date>2017-02-14T01:12:29Z</dc:date>
    <item>
      <title>How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271121#M81620</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;i have on a dashboard with 5 different searches, where i have a common (calculated) field (let's call it a score field), that i would like to extract and sum all the score field, in order to have a total score and then the average score.&lt;/P&gt;

&lt;P&gt;is that possible? and how?&lt;/P&gt;

&lt;P&gt;thank you very much for your help&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 17:05:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271121#M81620</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-01-31T17:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271122#M81621</link>
      <description>&lt;P&gt;Can you share your dashboard xml? &lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 17:08:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271122#M81621</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-31T17:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271123#M81622</link>
      <description>&lt;P&gt;Unfortunately i can't. I'll try to anonymize the information.&lt;/P&gt;

&lt;P&gt;but you can see it just as 5 differents queries with a common a field.&lt;/P&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 17:28:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271123#M81622</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-01-31T17:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271124#M81623</link>
      <description>&lt;P&gt;Natively it's not possible to get the values of field from various panels and show in separate panel. Only option would be merge all the searches together as a base search and use panels to populate data using post-process search. See this for more info on Post-Process in dashboards:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.1/Viz/Savedsearches#Post-process_searches"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.1/Viz/Savedsearches#Post-process_searches&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 17:30:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271124#M81623</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-31T17:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271125#M81624</link>
      <description>&lt;P&gt;Bingo! Also, this assumes all your values are integers. If some or all of your values are strings then you can change them to integers doing this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | convert num(FIELD_NAME)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 18:22:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271125#M81624</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2017-01-31T18:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271126#M81625</link>
      <description>&lt;P&gt;Ok. Thank you so much&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 09:08:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271126#M81625</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-02-01T09:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271127#M81626</link>
      <description>&lt;P&gt;ok. thank you very much&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 09:09:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271127#M81626</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-02-01T09:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271128#M81627</link>
      <description>&lt;P&gt;@papermalik - Did the comment provided by somesoni provide a solution to your question? If yes, please let me know so that I can convert it to an Answer to close out your question. If no, please leave a comment with more feedback. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 01:12:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271128#M81627</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2017-02-14T01:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271129#M81628</link>
      <description>&lt;P&gt;yes it did help, but the solution is not satisfying yet. Anyway, thank you very much&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 12:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271129#M81628</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-02-14T12:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271130#M81629</link>
      <description>&lt;P&gt;Within the scope of a dashboard, you could have each search populate a token &lt;CODE&gt;$score_1$&lt;/CODE&gt;, &lt;CODE&gt;$score_2$&lt;/CODE&gt;, etc. and then merge the five tokens into one overall score token - that score token can then be displayed in an HTML panel or whereever you like.&lt;/P&gt;

&lt;P&gt;Docs for setting the individual score tokens: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/Viz/EventHandlerReference#done"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.2/Viz/EventHandlerReference#done&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Working example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;score&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal | stats count&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;set token="score_1"&amp;gt;$result.count$&amp;lt;/set&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_audit | stats count&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;set token="score_2"&amp;gt;$result.count$&amp;lt;/set&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults | eval score = $score_1$ + $score_2$&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Feb 2017 13:00:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271130#M81629</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-14T13:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271131#M81630</link>
      <description>&lt;P&gt;Hello, i'm trying this technique but i'm having trouble.&lt;/P&gt;

&lt;P&gt;For the first query i have: | search sourcetype .......... | eval score_1=count*10&lt;/P&gt;

&lt;P&gt;For the second query i have: | search  sourcetype ...... | eval score_2=count*15&lt;/P&gt;

&lt;P&gt;So when i set the token for each query $score_2$ ? ? &lt;BR /&gt;
 each token is like a variable, so i'm giving to the token the resul of the eval.&lt;/P&gt;

&lt;P&gt;for the sum&lt;/P&gt;

&lt;P&gt;| makeresults (the different queries combined?)&lt;/P&gt;

&lt;P&gt;thanks for your help, bcause i'm have troubling to understand it&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 11:30:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271131#M81630</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-02-16T11:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271132#M81631</link>
      <description>&lt;P&gt;Did you copy my example into a new dashboard and try running it?&lt;/P&gt;

&lt;P&gt;The general flow is like this:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;query 1 runs with a result field&lt;/LI&gt;
&lt;LI&gt;the set element under query 1 takes the result field and writes that to the &lt;CODE&gt;score_1&lt;/CODE&gt; token&lt;/LI&gt;
&lt;LI&gt;query 2 runs with a result field&lt;/LI&gt;
&lt;LI&gt;the set element under query 2 takes the result field and writes that to the &lt;CODE&gt;score_2&lt;/CODE&gt; token&lt;/LI&gt;
&lt;LI&gt;Both tokens being now set, the third query runs and calculates the sum of both scores&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 16 Feb 2017 13:17:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271132#M81631</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-16T13:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271133#M81632</link>
      <description>&lt;P&gt;Ok i get it.&lt;/P&gt;

&lt;P&gt;It's still not working, maybe because i'm trying to display the result in a different panel?&lt;/P&gt;

&lt;P&gt;i even used $result.myfield$ to display only one field, but still no luck.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 15:35:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271133#M81632</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-02-17T15:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271134#M81633</link>
      <description>&lt;P&gt;"| makeresults | eval score = $result.count$ + $result.count$"&lt;BR /&gt;
This is what it does.&lt;/P&gt;

&lt;P&gt;it works when i put an integer&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 16:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271134#M81633</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-02-17T16:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271135#M81634</link>
      <description>&lt;P&gt;The panels don't matter. Do post your XML, much easier than guessing in the dark.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 16:44:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271135#M81634</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-17T16:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271136#M81635</link>
      <description>&lt;P&gt;&lt;CODE&gt;values(risk_score) as risk_rule&lt;/CODE&gt; yields a multi-value field, what result do you get when you run &lt;CODE&gt;sourcetype=web | stats count as count values(risk_score) as risk_rule by user  | eval risk_score_user=count*risk_rule | table user  risk_score_user count&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2017 20:07:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271136#M81635</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2017-02-17T20:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271137#M81636</link>
      <description>&lt;P&gt;oohh, i have a search with a token, so i can search by user. and the result is the according score to each user.&lt;BR /&gt;
when i don't give a user, it becomes then a multivalue result, so it won't work, but i put in entry a username it becomes a single value&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 08:53:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271137#M81636</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2017-02-20T08:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract and calculate the sum of a field from different searches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271138#M81637</link>
      <description>&lt;P&gt;I found it.&lt;/P&gt;

&lt;P&gt;It's probably a bug, but "| table user  risk_score_user count" was the problem. when i remove it, it works or i have to put commas between my fields.&lt;/P&gt;

&lt;P&gt;Thanks a lot for your time and effort&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:55:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-calculate-the-sum-of-a-field-from-different/m-p/271138#M81637</guid>
      <dc:creator>papemalik</dc:creator>
      <dc:date>2020-09-29T12:55:59Z</dc:date>
    </item>
  </channel>
</rss>

