Splunk Search

How do I add two rows with different identifiers and chart?

sriramv2006
Explorer

Hi,

I have a table like this:

Tag    |   Value
aa     |   15.5
bb     |    20
cc     |    23

I want to chart the value "dd = aa + bb" . Seems simple enough, but I haven't been able to find a solution through "sum" or "addtotals". 

I tried the below also, but no luck.
my_search_query | eval dd = aa + bb | chart latest(dd)

Your help is appreciated. Thanks in advance!

Labels (2)
0 Karma
1 Solution

sriramv2006
Explorer

Please ignore my question. My sum was trying to sum up strings. This worked:

my_search_query | eval dd = tonumber(aa) + tonumber(bb) | chart latest(dd)

View solution in original post

0 Karma

sriramv2006
Explorer

Please ignore my question. My sum was trying to sum up strings. This worked:

my_search_query | eval dd = tonumber(aa) + tonumber(bb) | chart latest(dd)

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

eval dd = aa + bb will create a field on each event in your pipeline adding fields aa and bb from that event. Are all these "tag"s and "value"s in different events? Is there anything else in the event that correlates aa and bb?

0 Karma

sriramv2006
Explorer

Thanks for your response!

Every event will have aa and bb rows. My "tag"s and "value"s can be from multiple events.

When I do the following, the chart/table comes up empty for "dd"
my_search_query | eval dd = aa + bb | chart latest(dd)

Since I'm looking for the latest event, tried this also:
my_search_query | eval dd = latest(aa) + latest(bb) | chart latest(dd)
But I get the following syntax error:
Error in 'eval' command: The 'latest' function is unsupported or undefined.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I am confused by your use of event and rows. Each event would normal take up one row in the events table. If aa and bb are different rows, then they are from different events as far as splunk is concerned. If these events are from the same event in application terms, e.g. the same application event generates multiple lines in a log which are ingested by splunk, as separate splunk events, is there a way from the event data to correlate these events so you know which aa belongs with which bb?

An example of your actual raw events as seen by splunk might be useful, although I recommend that you obfuscate any sensitive data.

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!

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...