Splunk Search

How to perform mathematical calculations based off one column

gdorman619
Engager

Hello,

I'm new to Splunk and I'm having trouble with the following line of code. I think what I'm trying to do is pretty self-explanatory. Essentially the data I'm working with is one column and the values in the column are "0" or "1".
Any help would be greatly appreciated. Thank you!

| stats sum(ACCESS_REVIEW_COMPLETE) \ count(ACCESS_REVIEW_COMPLETE)
0 Karma
1 Solution

niketn
Legend

@gdorman619 try the following search ratio field will have required output.

<yourCurrentSearch>
| stats sum(ACCESS_REVIEW_COMPLETE) as sum count(ACCESS_REVIEW_COMPLETE) as count
| eval ratio=round(sum/count,2)
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

@gdorman619 try the following search ratio field will have required output.

<yourCurrentSearch>
| stats sum(ACCESS_REVIEW_COMPLETE) as sum count(ACCESS_REVIEW_COMPLETE) as count
| eval ratio=round(sum/count,2)
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

gdorman619
Engager

Thank you very much! It worked.

prabhakar_ps
Explorer

| stats sum(ACCESS_REVIEW_COMPLETE) as Total count as count1
| eval result=(Total/count1)

Check if this helps

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...