Splunk Search

Calculate difference between values on timechart

dataisbeautiful
Communicator

Hi all

I'd like to plot the difference between two values on a timechart

Example data:

_timeab
t101
t+1s111.5
t+2s122

 

Expected resulting data

timeabc
t1019
t+1s111.59.5
t+2s12210

 

I'm using the query

 

 

 

index=indx sourcetype=src (Instrument="a" OR Instrument="b")
| eval c = a - b
| timechart values(a) values(b) values(c) span=1s

 

 

 

Any ideas where I'm going wrong?

Labels (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @dataisbeautiful,

try to add eval after the timechart:

index=indx sourcetype=src (Instrument="a" OR Instrument="b")
| timechart values(a) values(b) span=1s
| eval c = a - b

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @dataisbeautiful,

try to add eval after the timechart:

index=indx sourcetype=src (Instrument="a" OR Instrument="b")
| timechart values(a) values(b) span=1s
| eval c = a - b

Ciao.

Giuseppe

dataisbeautiful
Communicator

Thank you @gcusello, that worked

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...