All Apps and Add-ons

how to calculate increase rate for every month

hqw
Path Finder

Hi all,

I have below data extracted from splunk:

2015-02 1000
2015-03 1340
2015-04 1600
2015-05 2000

I want to calculate and display my deviation number for every month, could any one guide me how to calculate it? for example, the deviation of the first and second month is :(1340-1000)/1000, the deviation of second and third is (1600-1340)/1340

my current search is below:

** | chart sum(sum_count) as "Number of count" by month

Thanks in advance

0 Karma
1 Solution

lguinn2
Legend

I would do this

yoursearchhere
| chart sum(sum_count) as current_count by month
| streamstats last(current_count) as last_count current=f window=2
| eval deviation = round( (current_count - last_count) / last_count, 3)
| fields - last_count
| rename current_count as "Number of count"

View solution in original post

lguinn2
Legend

I would do this

yoursearchhere
| chart sum(sum_count) as current_count by month
| streamstats last(current_count) as last_count current=f window=2
| eval deviation = round( (current_count - last_count) / last_count, 3)
| fields - last_count
| rename current_count as "Number of count"
Get Updates on the Splunk Community!

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...

What's New in Splunk Cloud Platform 9.2.2403?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2403! Analysts can ...

Stay Connected: Your Guide to July and August Tech Talks, Office Hours, and Webinars!

Dive into our sizzling summer lineup for July and August Community Office Hours and Tech Talks. Scroll down to ...