<?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 do I create an evaluated expression based on an aggregate in the Pivot? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-evaluated-expression-based-on-an-aggregate-in/m-p/153292#M43011</link>
    <description>&lt;P&gt;After reading this answer by gkanapathy (&lt;A href="http://answers.splunk.com/answers/34208/eval-mean-something-when-data-is-split-by-another-field.html#answer-34240"&gt;http://answers.splunk.com/answers/34208/eval-mean-something-when-data-is-split-by-another-field.html#answer-34240&lt;/A&gt; ) I came to the solution.&lt;/P&gt;

&lt;P&gt;What I did was use &lt;CODE&gt;eventstats&lt;/CODE&gt; to add the average first, and then use stats and eval to build up my string. Something like this:    &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | eventstats avg(Age) as CalcAvgAvge by GroupName | stats first(eval(if(CalcAvgAvge&amp;gt;35, "True", "False"))) AS AverageAgeGreaterThan35, avg(Age) as AverageAge, avg(Grade) as AverageGrade by GroupName,
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Apr 2015 21:07:37 GMT</pubDate>
    <dc:creator>chustar</dc:creator>
    <dc:date>2015-04-24T21:07:37Z</dc:date>
    <item>
      <title>How do I create an evaluated expression based on an aggregate in the Pivot?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-evaluated-expression-based-on-an-aggregate-in/m-p/153291#M43010</link>
      <description>&lt;P&gt;I'm currently building a report using Pivot tables. I'm trying to get my data model to look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;GroupName    AverageAge   AverageGrade    AverageAgeGreaterThan35
GroupA            30        90             False
GroupB            40        12             True
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this case, the AverageAgeGreaterThan35 column would be an evaluated expression.&lt;BR /&gt;
I've tried doing this using an evaluated expression but it evaluates for each value, not the average value.&lt;BR /&gt;
Is there a way to write the evaluated expression to support this? &lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 16:51:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-evaluated-expression-based-on-an-aggregate-in/m-p/153291#M43010</guid>
      <dc:creator>chustar</dc:creator>
      <dc:date>2015-04-21T16:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an evaluated expression based on an aggregate in the Pivot?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-evaluated-expression-based-on-an-aggregate-in/m-p/153292#M43011</link>
      <description>&lt;P&gt;After reading this answer by gkanapathy (&lt;A href="http://answers.splunk.com/answers/34208/eval-mean-something-when-data-is-split-by-another-field.html#answer-34240"&gt;http://answers.splunk.com/answers/34208/eval-mean-something-when-data-is-split-by-another-field.html#answer-34240&lt;/A&gt; ) I came to the solution.&lt;/P&gt;

&lt;P&gt;What I did was use &lt;CODE&gt;eventstats&lt;/CODE&gt; to add the average first, and then use stats and eval to build up my string. Something like this:    &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | eventstats avg(Age) as CalcAvgAvge by GroupName | stats first(eval(if(CalcAvgAvge&amp;gt;35, "True", "False"))) AS AverageAgeGreaterThan35, avg(Age) as AverageAge, avg(Grade) as AverageGrade by GroupName,
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Apr 2015 21:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-evaluated-expression-based-on-an-aggregate-in/m-p/153292#M43011</guid>
      <dc:creator>chustar</dc:creator>
      <dc:date>2015-04-24T21:07:37Z</dc:date>
    </item>
  </channel>
</rss>

