Splunk Search

calculate overall total stats after certain date from other field

dhavamanis
Builder

Can you please help me to get the stats after July 16th 2018 from other column value sum. We had a valid data from starting to July 16th and after that Overall_Total coming as 0 and we need to calculate overall total from other column "Daily_Count".

sample data,

Date,Brand,Daily_count,Overall_Total
01/01/2018,xxx,20,1500
02/01/2018,yyy,10,100
07/16/2018,xxx,10,1510
07/16/2018,yyy,20,120
07/17/2018,xxx,40,0
07/17/2018,yyy,30,0

Can you please help me to get overall total with previous max + after July 16th Daily_Count.
Expected result,

07/17/2018,xxx,40,15500
07/17/2018,yyy,30,150

Tags (1)
0 Karma

Vijeta
Influencer

Try something like this-

 <your query>| eval x=if(Date>"07/16/2018", Daily_count,0)| eval Total=x + Overall_Total| stats latest(Date) as Date , sum(Total) as Overall_Total, sum(x) as Daily_count by Brand
0 Karma
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, ...