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!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...