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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...