Splunk Search

How do I create an evaluated expression based on an aggregate in the Pivot?

chustar
Path Finder

I'm currently building a report using Pivot tables. I'm trying to get my data model to look like this:

GroupName    AverageAge   AverageGrade    AverageAgeGreaterThan35
GroupA            30        90             False
GroupB            40        12             True

In this case, the AverageAgeGreaterThan35 column would be an evaluated expression.
I've tried doing this using an evaluated expression but it evaluates for each value, not the average value.
Is there a way to write the evaluated expression to support this?

Tags (4)
0 Karma
1 Solution

chustar
Path Finder

After reading this answer by gkanapathy (http://answers.splunk.com/answers/34208/eval-mean-something-when-data-is-split-by-another-field.html... ) I came to the solution.

What I did was use eventstats to add the average first, and then use stats and eval to build up my string. Something like this:

* | eventstats avg(Age) as CalcAvgAvge by GroupName | stats first(eval(if(CalcAvgAvge>35, "True", "False"))) AS AverageAgeGreaterThan35, avg(Age) as AverageAge, avg(Grade) as AverageGrade by GroupName,

View solution in original post

chustar
Path Finder

After reading this answer by gkanapathy (http://answers.splunk.com/answers/34208/eval-mean-something-when-data-is-split-by-another-field.html... ) I came to the solution.

What I did was use eventstats to add the average first, and then use stats and eval to build up my string. Something like this:

* | eventstats avg(Age) as CalcAvgAvge by GroupName | stats first(eval(if(CalcAvgAvge>35, "True", "False"))) AS AverageAgeGreaterThan35, avg(Age) as AverageAge, avg(Grade) as AverageGrade by GroupName,
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...