Splunk Search

How do you calculate the average for a chart count over table?

cfstoica
New Member

How do you add another column that contains averages based on previous columns after "chart count over Level by Month"?

Level Month1 Month2 Month3 Average
1 2 3 4 3
2 4 5 6 5
3 4 6 8 6
....

0 Karma

renjith_nair
SplunkTrust
SplunkTrust

@cfstoica,

If the number of months are dynamic, then give this a try,

chart count over Level by Month|addtotals|eval Total=Total-Level|eval colcount=-3
|foreach * [eval colcount=colcount+1]|eval Average=Total/colcount|fields - Total,colcount
Happy Splunking!
0 Karma

kmorris_splunk
Splunk Employee
Splunk Employee

Is it always the same columns? You could do something like the following if so:

... | eval avgbylevel=(Month1 + Month2 + Month3)/3 | table Level Month1 Month2 Month3 avgbylevel
0 Karma
Get Updates on the Splunk Community!

Splunk APM & RUM | Upcoming Planned Maintenance

There will be planned maintenance of the streaming infrastructure for Splunk APM and Splunk RUM in the coming ...

Part 2: Diving Deeper With AIOps

Getting the Most Out of Event Correlation and Alert Storm Detection in Splunk IT Service Intelligence   Watch ...

User Groups | Upcoming Events!

If by chance you weren't already aware, the Splunk Community is host to numerous User Groups, organized ...