- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to go about stats count by a values between a range?
jenkinsta
Path Finder
06-14-2023
01:06 PM
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"
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
isoutamo

SplunkTrust
06-14-2023
01:32 PM
Hi
here is link / example how you should do it.
- https://docs.splunk.com/Documentation/SplunkCloud/latest/Search/Usestatswithevalexpressionsandfuncti...
- https://community.splunk.com/t5/Splunk-Search/Perform-stats-count-based-on-the-value-of-a-field/m-p/...
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
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
jenkinsta
Path Finder
06-14-2023
01:50 PM
THanks got it to work without the if statement was almost there just didnt think about the eval for that.
