Dashboards & Visualizations

How to calculate Total of two values

aditsss
Motivator

Hi all,

Can someone guide me how can we calculate two fields.

I have two fields in my lookup file OPEN and Closed. I need their total.

 How can we do that.

Labels (2)
0 Karma
1 Solution

manjunathmeti
Champion

You can use stats command. If you want to count the number of events,

| stats count(OPEN) as open_count count(Closed) as closed_count | eval total_count = open_count + closed_count

If you want to get the sum of the field numerical values,

| stats sum(OPEN) as open_sum sum(Closed) as closed_sum | eval total = open_sum + closed_sum

Refer to this page for more examples: https://docs.splunk.com/Documentation/SCS/current/SearchReference/StatsCommandExamples#1._Calculate_...

If this reply helps you, an upvote/like would be appreciated.

View solution in original post

manjunathmeti
Champion

You can use stats command. If you want to count the number of events,

| stats count(OPEN) as open_count count(Closed) as closed_count | eval total_count = open_count + closed_count

If you want to get the sum of the field numerical values,

| stats sum(OPEN) as open_sum sum(Closed) as closed_sum | eval total = open_sum + closed_sum

Refer to this page for more examples: https://docs.splunk.com/Documentation/SCS/current/SearchReference/StatsCommandExamples#1._Calculate_...

If this reply helps you, an upvote/like would be appreciated.

Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...