<?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: getting error with stats in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299410#M3828</link>
    <description>&lt;P&gt;Hi , thanks for your response, i tried what you gave above, but it did not give me the correct output.&lt;/P&gt;

&lt;P&gt;the output of Yes, Total and Compliance is below. its already updated. what i am trying is to get the average value of Compliance. if i do avg(compliance) i get a different value and if i do sum(yes)/sum(total)*100 for compliance i get a different value, which is the correct one.&lt;/P&gt;

&lt;P&gt;could you help me get the correct average from this table using stats or any other way.&lt;/P&gt;

&lt;P&gt;Yes Total   Compliance&lt;BR /&gt;
0   1   0&lt;BR /&gt;
0   4   0&lt;BR /&gt;
1   1   100&lt;BR /&gt;
224 225 99.56&lt;BR /&gt;
5   5   100&lt;BR /&gt;
15  15  100&lt;BR /&gt;
88  92  95.65&lt;/P&gt;</description>
    <pubDate>Fri, 30 Mar 2018 16:01:17 GMT</pubDate>
    <dc:creator>jiaqya</dc:creator>
    <dc:date>2018-03-30T16:01:17Z</dc:date>
    <item>
      <title>getting error with stats</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299408#M3826</link>
      <description>&lt;P&gt;i have numbers in Yes and Total columns and am trying to get a result using stats . but i keep getting error. not sure how to do this, can you help.&lt;/P&gt;

&lt;P&gt;|stats  eval(Yes/Total)*100 as Compliance &lt;/P&gt;

&lt;P&gt;Error in 'stats' command: The aggregation specifier 'eval(Yes/Total)*100' is invalid. The aggregation specifier must be in &lt;A href="https://community.splunk.com/%5Bkey%5D"&gt;func_name&lt;/A&gt; format.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 15:37:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299408#M3826</guid>
      <dc:creator>jiaqya</dc:creator>
      <dc:date>2018-03-30T15:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: getting error with stats</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299409#M3827</link>
      <description>&lt;P&gt;you cannot use &lt;CODE&gt;eval&lt;/CODE&gt; inside of a &lt;CODE&gt;stats&lt;/CODE&gt; command like that. try forming it more like this&lt;BR /&gt;
&lt;CODE&gt;|eval Compliance=(Yes/Total)*100)|stats values(Compliance) as Compliance&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 15:53:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299409#M3827</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-03-30T15:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: getting error with stats</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299410#M3828</link>
      <description>&lt;P&gt;Hi , thanks for your response, i tried what you gave above, but it did not give me the correct output.&lt;/P&gt;

&lt;P&gt;the output of Yes, Total and Compliance is below. its already updated. what i am trying is to get the average value of Compliance. if i do avg(compliance) i get a different value and if i do sum(yes)/sum(total)*100 for compliance i get a different value, which is the correct one.&lt;/P&gt;

&lt;P&gt;could you help me get the correct average from this table using stats or any other way.&lt;/P&gt;

&lt;P&gt;Yes Total   Compliance&lt;BR /&gt;
0   1   0&lt;BR /&gt;
0   4   0&lt;BR /&gt;
1   1   100&lt;BR /&gt;
224 225 99.56&lt;BR /&gt;
5   5   100&lt;BR /&gt;
15  15  100&lt;BR /&gt;
88  92  95.65&lt;/P&gt;</description>
      <pubDate>Fri, 30 Mar 2018 16:01:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299410#M3828</guid>
      <dc:creator>jiaqya</dc:creator>
      <dc:date>2018-03-30T16:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: getting error with stats</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299411#M3829</link>
      <description>&lt;P&gt;how about something like this?&lt;BR /&gt;
&lt;CODE&gt;...|addcoltotals labelfield=Compliance|search Compliance="Total"|eval Compliance=(Yes/Total)*100&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;i put your data in this table so you can see what i did:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval data="Yes=0,Total=1,Compliance=0 Yes=0,Total=4,Compliance=0 Yes=1,Total=1,Compliance=100 Yes=224,Total=225,Compliance=99.56 Yes=5,Total=5,Compliance=100 Yes=15,Total=15,Compliance=100 Yes=88,Total=92,Compliance=99.65"|makemv data|mvexpand data|rename data as _raw|kv|table Yes Total Compliance|addcoltotals labelfield=Compliance|search Compliance="Total"|eval Compliance=(Yes/Total)*100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Mar 2018 16:31:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299411#M3829</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2018-03-30T16:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: getting error with stats</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299412#M3830</link>
      <description>&lt;P&gt;it did help me . thanks&lt;/P&gt;</description>
      <pubDate>Sat, 31 Mar 2018 21:16:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/getting-error-with-stats/m-p/299412#M3830</guid>
      <dc:creator>jiaqya</dc:creator>
      <dc:date>2018-03-31T21:16:00Z</dc:date>
    </item>
  </channel>
</rss>

