Splunk Search

How to build a two way table?

Clovisa
Path Finder

Hi !

I am trying to build a two way table like :

|          | Male | Female | Total |
| Child    | 2    | 3      | 5     |
| Teenager | 2    | 1      | 3     |
| Adult    | 10   | 11     | 21    |

I see how to count by gender or by age but I don't see how I can have both in the same table. Your help will be very appreciated, thanks!

Tags (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi Clovisa,
see the chart command ( http://docs.splunk.com/Documentation/Splunk/7.1.1/SearchReference/Chart ).
you should try something like this

index=my_index
| chart count OVER age BY gender
| addtotals
| addcoltotals labelfield=age label="Total"

Bye.
Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi Clovisa,
see the chart command ( http://docs.splunk.com/Documentation/Splunk/7.1.1/SearchReference/Chart ).
you should try something like this

index=my_index
| chart count OVER age BY gender
| addtotals
| addcoltotals labelfield=age label="Total"

Bye.
Giuseppe

0 Karma

Clovisa
Path Finder

It's perfect, thanks a lot Giuseppe !

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...