Splunk Search

How to average the values of duplicate entries?

crucifier_0
Explorer

Hi,

Suppose I have these following entries in a table

A-  1

A - 2

A - 3

B - 1

B-  2

I want to average the values of the same key. Something like this,

A-  3.5

B - 1.5

Help me out on this 

Labels (4)
Tags (1)
0 Karma
1 Solution

gcusello
Legend

Hi @crucifier_0,

supposing that the field names in the table are "type" and "value", you should run a search using the stats command, something like this:

your_search
| stats avg(value) AS avg_value BY type

Anyway, I hint to follow the Splunk Search Tutorial at https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchTutorial/WelcometotheSearchTutorial or follow some video tutorial on YouTube.

Ciao.

Giuseppe

View solution in original post

gcusello
Legend

Hi @crucifier_0,

supposing that the field names in the table are "type" and "value", you should run a search using the stats command, something like this:

your_search
| stats avg(value) AS avg_value BY type

Anyway, I hint to follow the Splunk Search Tutorial at https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchTutorial/WelcometotheSearchTutorial or follow some video tutorial on YouTube.

Ciao.

Giuseppe

rnowitzki
Builder

Hi @crucifier_0 

Suppose your columns are called "letter" and "number":

| stats avg(number) by letter

 
Hope this is what you asked for.

BR
Ralph

--
Karma and/or Solution tagging appreciated.
Get Updates on the Splunk Community!

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...

Reminder! Splunk Love Promo: $25 Visa Gift Card for Your Honest SOAR Review With ...

We recently launched our first Splunk Love Special, and it's gone phenomenally well, so we're doing it again, ...