<?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: Nesting a round function in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Nesting-a-round-function/m-p/140700#M38894</link>
    <description>&lt;P&gt;You can do the rounding straight away without additional piping, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | chart eval(round(avg(TheCost),2)) by ProductSku Month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For doing more complicated things to fields with dynamic names and numbers, take a look at the &lt;CODE&gt;foreach&lt;/CODE&gt; command: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/foreach"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/foreach&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2014 20:19:35 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-02-06T20:19:35Z</dc:date>
    <item>
      <title>Nesting a round function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nesting-a-round-function/m-p/140699#M38893</link>
      <description>&lt;P&gt;Say I want to calculate the average cost of spending on each SKU, say, by month. The AVG function by SKU works great, but I want to round every value in the resulting matrix to the nearest cent like so:&lt;/P&gt;

&lt;P&gt;round(avg(TheCost),2) by ProductSku Month&lt;/P&gt;

&lt;P&gt;That syntax doesn't work and I can't pipe it to another eval for the round like I could without the double attributes in the BY clause. After that operation that averages by month and Sku, I have a huge matrix of rows and coulmns and I can't figure out how to round each column and feed that list back into the round function and have it come out as a matrix again. Rounding before the average of course does not help. Thoughts? Is there a switch to set the default precision on a an average or something that might help?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 20:05:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nesting-a-round-function/m-p/140699#M38893</guid>
      <dc:creator>smileyge</dc:creator>
      <dc:date>2014-02-06T20:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting a round function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nesting-a-round-function/m-p/140700#M38894</link>
      <description>&lt;P&gt;You can do the rounding straight away without additional piping, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | chart eval(round(avg(TheCost),2)) by ProductSku Month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For doing more complicated things to fields with dynamic names and numbers, take a look at the &lt;CODE&gt;foreach&lt;/CODE&gt; command: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/foreach"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/foreach&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 20:19:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nesting-a-round-function/m-p/140700#M38894</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-02-06T20:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Nesting a round function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nesting-a-round-function/m-p/140701#M38895</link>
      <description>&lt;P&gt;Nice, I didn't know to add the eval around the nested math, that did it!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 20:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nesting-a-round-function/m-p/140701#M38895</guid>
      <dc:creator>smileyge</dc:creator>
      <dc:date>2014-02-06T20:53:21Z</dc:date>
    </item>
  </channel>
</rss>

