Dashboards & Visualizations

Finding Average based on last 5 days transaction?

ubp1252
Explorer

Hi,

We have data which will display total tarnsactions and success transactions count based on our time range.But we got one requirement that when some incident happen that time the count we are getting very less compared to other days.So our target is whenever we got that type less transactions we need to average for last 3 days total transactions and display that number instead of less transaction count.Please help how to solve this.

Sample Data:

DateTotal_tranasactionsSuccess_tranasactions
01-04-2021   8070
02-04-2021   7570
03-04-2021   10090
04-04-2021   102

 

Expected Output:

DateTotal_tranasactionsSuccess_tranasactions
01-04-2021   8070
02-04-2021   7570
03-04-2021   10090
04-04-2021  avg of last 3 days2
Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| streamstats window=3 sum(Total_tranasactions) as rolling3total count as days by Date
| eval average3days=rolling3total / days
| eval Total_tranasactions=if(Total_tranasactions < 20, average3days, Total_tranasactions)
0 Karma
Get Updates on the Splunk Community!

Index This | What’s a riddle wrapped in an enigma?

September 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

BORE at .conf25

Boss Of Regular Expression (BORE) was an interactive session run again this year at .conf25 by the brilliant ...

OpenTelemetry for Legacy Apps? Yes, You Can!

This article is a follow-up to my previous article posted on the OpenTelemetry Blog, "Your Critical Legacy App ...