Splunk Search

Grouping multiple times

raby1996
Path Finder

Basically I would like to run one stats command where i do some arithmetic and correlation based on one grouping, but i would like to display the results using a different grouping, for example I'm run-in my first stats command grouping by bundle, and display those results grouped by Build.

Thank you

0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi raby1996,

The important part is to pass on any needed field for the second stats by adding it to the first stats. Try something like this:

your base search here | stats .... by bundle, Build .... | stats ... by Build

Hope this helps ...

cheers, MuS

View solution in original post

MuS
SplunkTrust
SplunkTrust

Hi raby1996,

The important part is to pass on any needed field for the second stats by adding it to the first stats. Try something like this:

your base search here | stats .... by bundle, Build .... | stats ... by Build

Hope this helps ...

cheers, MuS

raby1996
Path Finder

Hmmmm i might be doing something wrong, here is my first stats

Base Search

| stats values(Group) as Group list("SFI Level") AS LIC2 count list(MTMS) AS MTMS ,list(Build) AS Build list(it2) AS Current_Bundle_Date , list(nowstring) AS Search_Date(Today) , list(TD) AS Difference , sum(TD) AS Sum, by Bundle
| eval MM=Sum/30.4

and my second stats which doesn't give me the right MM

|stats  list(Bundle), list(LIC2),list(Build),list(count), by Group

Basically I want to group differently without it affecting my results from the first stats(specifically MM) if that makes sense?
P.S I apologize I actaully want to group by "Group" i just changed the name in my question to make it less confusing .
Thank you!

0 Karma

MuS
SplunkTrust
SplunkTrust

hmm looks like I don't get it; those are two different stats by so the result will not be the same?!?

0 Karma

raby1996
Path Finder

Yes you were correct I just had to write and additional stats command with MM included

0 Karma

MuS
SplunkTrust
SplunkTrust

If this answers your question, please accept the answer - thanks 🙂

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!

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...