Splunk Search

How to go about stats count by a values between a range?

jenkinsta
Path Finder

I am trying to return data for a pie chart with a specified range of values. How would I go about this? 

 

| stats count(Score < 5) as "0-4.9" count(Score >=5 AND Score <=8) as "5-8"

 

Labels (1)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

here is link / example how you should do it.

In your case something like

 

 | stats count(eval(Score < 5)) as "0-4.9" count(eval(if(Score >=5 AND Score <=8),1,0)) as "5-8"

 

r. Ismo 

0 Karma

jenkinsta
Path Finder

THanks got it to work without the if statement was almost there just didnt think about the eval for that. 

Get Updates on the Splunk Community!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...