<?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 calcualte an Eval of percentage between two rows of stats values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674704#M230955</link>
    <description>&lt;P&gt;By the look of your screenshot shared, it appears that as a result of the&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(NumberOfAuthErrors) AS NumberOfAuthErrors, values(TotalRequest) AS TotalRequest&lt;/LI-CODE&gt;&lt;P&gt;is returning you two multivalued fields, so the eval is not working as intended.&lt;BR /&gt;Try putting this stats with an additional by-field of _time again, that way each NumberOfAuthErrors and TotalRequest values should only have 1 value for each 15 minute interval and then the eval will probably work.&lt;BR /&gt;&lt;BR /&gt;If for whatever reason you are trying to sum up each row of two multivalued fields (Don't really know why you would want to do this), I would stay away from using stats values() as this is going to dedup values and then I believe sort them. using stats list() instead will retain the original order, but even then, if one of the datasets is missing events in one or more of the 15 minute intervals, then number will again be misaligned.&lt;BR /&gt;&lt;BR /&gt;You would be better off just using a stats by-field of _time again, something like this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[SEARCH]
| bin _time span=15m
| stats count as NumberOfAuthErrors by _time
| append
[ SEARCH | bin _time span=15m | stats count as TotalRequest by _time ]
| stats values(NumberOfAuthErrors) AS NumberOfAuthErrors, values(TotalRequest) AS TotalRequest by _time
| eval failureRate = round((NumberOfAuthErrors / TotalRequest) * 100,3)
| table _time, TotalRequest NumberOfAuthErrors failureRate&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;If you just want the overall failureReate through the entire timespan the using a stats sum() will probably be the way to go.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[SEARCH]
| bin _time span=15m
| stats count as NumberOfAuthErrors by _time
| append
[ SEARCH | bin _time span=15m | stats count as TotalRequest by _time ]
| stats sum(NumberOfAuthErrors) AS NumberOfAuthErrors, sum(TotalRequest) AS TotalRequest
| eval failureRate = round((NumberOfAuthErrors / TotalRequest) * 100,3)
| table TotalRequest NumberOfAuthErrors failureRate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 17:06:37 GMT</pubDate>
    <dc:creator>dtburrows3</dc:creator>
    <dc:date>2024-01-18T17:06:37Z</dc:date>
    <item>
      <title>How to calcualte an Eval of percentage between two rows of stats values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674699#M230952</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm trying to calculate the failureRate as a percentage between the NumberOfAuthErrors column and the TotalRequest column, but i do not get any values.&lt;/P&gt;&lt;P&gt;I do have two columns of values. I would like to calculate the failureRate for each ROW.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[SEARCH]
| bin _time span=15m
| stats count as NumberOfAuthErrors by _time
| append
[ SEARCH | bin _time span=15m | stats count as TotalRequest by _time ]
| stats values(NumberOfAuthErrors) AS NumberOfAuthErrors, values(TotalRequest) AS TotalRequest
| eval failureRate = round((NumberOfAuthErrors / TotalRequest) * 100,3)
| table TotalRequest NumberOfAuthErrors failureRate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 16:57:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674699#M230952</guid>
      <dc:creator>becksyboy</dc:creator>
      <dc:date>2024-01-18T16:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcualte an Eval of percentage between two rows of stats values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674703#M230954</link>
      <description>&lt;P&gt;Try including by _time on this line&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(NumberOfAuthErrors) AS NumberOfAuthErrors, values(TotalRequest) AS TotalRequest by _time&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 18 Jan 2024 17:06:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674703#M230954</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-01-18T17:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcualte an Eval of percentage between two rows of stats values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674704#M230955</link>
      <description>&lt;P&gt;By the look of your screenshot shared, it appears that as a result of the&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(NumberOfAuthErrors) AS NumberOfAuthErrors, values(TotalRequest) AS TotalRequest&lt;/LI-CODE&gt;&lt;P&gt;is returning you two multivalued fields, so the eval is not working as intended.&lt;BR /&gt;Try putting this stats with an additional by-field of _time again, that way each NumberOfAuthErrors and TotalRequest values should only have 1 value for each 15 minute interval and then the eval will probably work.&lt;BR /&gt;&lt;BR /&gt;If for whatever reason you are trying to sum up each row of two multivalued fields (Don't really know why you would want to do this), I would stay away from using stats values() as this is going to dedup values and then I believe sort them. using stats list() instead will retain the original order, but even then, if one of the datasets is missing events in one or more of the 15 minute intervals, then number will again be misaligned.&lt;BR /&gt;&lt;BR /&gt;You would be better off just using a stats by-field of _time again, something like this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[SEARCH]
| bin _time span=15m
| stats count as NumberOfAuthErrors by _time
| append
[ SEARCH | bin _time span=15m | stats count as TotalRequest by _time ]
| stats values(NumberOfAuthErrors) AS NumberOfAuthErrors, values(TotalRequest) AS TotalRequest by _time
| eval failureRate = round((NumberOfAuthErrors / TotalRequest) * 100,3)
| table _time, TotalRequest NumberOfAuthErrors failureRate&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;If you just want the overall failureReate through the entire timespan the using a stats sum() will probably be the way to go.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[SEARCH]
| bin _time span=15m
| stats count as NumberOfAuthErrors by _time
| append
[ SEARCH | bin _time span=15m | stats count as TotalRequest by _time ]
| stats sum(NumberOfAuthErrors) AS NumberOfAuthErrors, sum(TotalRequest) AS TotalRequest
| eval failureRate = round((NumberOfAuthErrors / TotalRequest) * 100,3)
| table TotalRequest NumberOfAuthErrors failureRate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 17:06:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674704#M230955</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-18T17:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcualte an Eval of percentage between two rows of stats values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674716#M230960</link>
      <description>&lt;P&gt;Thank You for the help, the missing by clause worked (by _time)&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 17:48:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674716#M230960</guid>
      <dc:creator>becksyboy</dc:creator>
      <dc:date>2024-01-18T17:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to calcualte an Eval of percentage between two rows of stats values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674717#M230961</link>
      <description>&lt;P&gt;Thank you also for the same solution and the additional context, this is really helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 17:49:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calcualte-an-Eval-of-percentage-between-two-rows-of-stats/m-p/674717#M230961</guid>
      <dc:creator>becksyboy</dc:creator>
      <dc:date>2024-01-18T17:49:17Z</dc:date>
    </item>
  </channel>
</rss>

