Reporting

Calculate Difference Between Same Field in Different Rows

he204035
Explorer

If I have the following table using columns DATE and USAGE, is there a way to create a 3rd column to display the difference in the USAGE column from Day X to previous day?

 

DATE USAGE

Feb-28
Feb-29
Mar-01
Mar-02
Mar-03
Mar-04
Mar-05
Mar-06
Mar-07
Mar-08
Mar-09
Mar-10
Mar-11
Mar-12
17.68 gb
18.53 gb
19.66 gb
21.09 gb
22.04 gb
23.21 gb
24.20 gb
24.94 gb
25.64 gb
26.80 gb
27.79 gb
29.07 gb
30.09 gb
31.01 gb
Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Assuming these are numeric (not strings), you can use streamstats

| streamstats window=2 range(USAGE) as difference
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...