<?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 do a simple calculation based on two form values? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196990#M12326</link>
    <description>&lt;P&gt;Can be achieved using post processing searches. &lt;BR /&gt;
Make the selections mentioned in the search template, please refer ui examples app.&lt;/P&gt;

&lt;P&gt;Once you have the parent search, insert a separate chart panel to do some thing like table someResult.&lt;BR /&gt;
someResult would be (token1*token2*constant). There might be other ways to do it.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:08:15 GMT</pubDate>
    <dc:creator>Raghav2384</dc:creator>
    <dc:date>2020-09-28T18:08:15Z</dc:date>
    <item>
      <title>How to do a simple calculation based on two form values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196989#M12325</link>
      <description>&lt;P&gt;I've got two tokens in an input form, let's call them token1 and token2.  They are each used to construct some searches, and that's all fine and good.&lt;/P&gt;

&lt;P&gt;I'd also like to do a simple calculation based on these, like: someResult = token1 x token2 x someConstant, and display that in a single value panel.&lt;/P&gt;

&lt;P&gt;I just can't figure out how to do that without an actual search involved.  It's got to be easy... right?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 15:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196989#M12325</guid>
      <dc:creator>apnetmedic</dc:creator>
      <dc:date>2014-11-06T15:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a simple calculation based on two form values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196990#M12326</link>
      <description>&lt;P&gt;Can be achieved using post processing searches. &lt;BR /&gt;
Make the selections mentioned in the search template, please refer ui examples app.&lt;/P&gt;

&lt;P&gt;Once you have the parent search, insert a separate chart panel to do some thing like table someResult.&lt;BR /&gt;
someResult would be (token1*token2*constant). There might be other ways to do it.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:08:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196990#M12326</guid>
      <dc:creator>Raghav2384</dc:creator>
      <dc:date>2020-09-28T18:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a simple calculation based on two form values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196991#M12327</link>
      <description>&lt;P&gt;Even easier is probably something like:&lt;BR /&gt;
&lt;CODE&gt;| stats count(_raw) | eval someResult = token1 * token2 * someConstant | table someResult&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;That spends minimal time on the search, which returns 0 events, then stats count() returns 1 row, and my eval then produces something.    &lt;/P&gt;

&lt;P&gt;EDIT:  took out an initial empty search.  @somesoni2 led me there with the | gentimes | idea.  That works too, really anything that will generate one row of data to throw away.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 15:57:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196991#M12327</guid>
      <dc:creator>apnetmedic</dc:creator>
      <dc:date>2014-11-06T15:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a simple calculation based on two form values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196992#M12328</link>
      <description>&lt;P&gt;You can create dummy results using gentimes without hitting any actual index/sourcetype.&lt;/P&gt;

&lt;P&gt;e.g.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|gentimes start=-1 |  eval someResult = $token1$ * $token2$ * someConstant | table someResult
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Nov 2014 16:09:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196992#M12328</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-11-06T16:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a simple calculation based on two form values?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196993#M12329</link>
      <description>&lt;P&gt;I believe the best way would be to use calculated fields - &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.0/Knowledge/definecalcfields"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.0/Knowledge/definecalcfields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In props.conf, you could set up a calculated field such as:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
[&amp;lt;stanza&amp;gt;]&lt;BR /&gt;
EVAL-&amp;lt;field_name&amp;gt; = &amp;lt;eval statement&amp;gt;&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;which in your case:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
[&amp;lt;your_stanza&amp;gt;]&lt;BR /&gt;
EVAL-someResult = token1 * token2 * &amp;lt;someConstant&amp;gt;&lt;BR /&gt;
&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 19:22:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-do-a-simple-calculation-based-on-two-form-values/m-p/196993#M12329</guid>
      <dc:creator>jlin</dc:creator>
      <dc:date>2014-11-06T19:22:33Z</dc:date>
    </item>
  </channel>
</rss>

