Splunk Search

How to calculate the percentage change over a month based on delta?

hqw
Path Finder

hi all,

I want a new column which calculates the percentage change over a month. In the below snapshot, the change rate should equal to the diff/sum of last month. One example is percentage=41703/299981.
however, if I add a new command behind :|eval percentage=round(dif/sum,1), it will calculate by 41703/341684, which is not correct.

could any one help me out of this?

thanks in advance.

alt text

Tags (2)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Replace your delta with this:

... | streamstats current=f window=1 last(sum) as last_sum | eval dif = sum - last_sum | eval percentage = round(dif/last_sum, 1)

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

Replace your delta with this:

... | streamstats current=f window=1 last(sum) as last_sum | eval dif = sum - last_sum | eval percentage = round(dif/last_sum, 1)
Get Updates on the Splunk Community!

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 ...

Edge Processor Scaling, Energy & Manufacturing Use Cases, and More New Articles on ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Get More Out of Your Security Practice With a SIEM

Get More Out of Your Security Practice With a SIEMWednesday, July 31, 2024  |  11AM PT / 2PM ETREGISTER ...