Splunk Search

create table/chart like excel pivot

ishaanshekhar
Communicator

I need to make a chart of nested columns like we can do in excel pivot.

Sample data and required view is given in the screenshot:

alt text

Is it possible to achieve this in SPLUNK? If not, what best can be done in this case? Please advise.

Thank you so much!

Tags (3)
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try something like this

your base search giving fields Organization Unit Ticket_state Severity Year Count
| eval RowLabel=Organiation."-".Unit."-".Ticket_state."-".Severity | chart sum(count) as count over RowLabel by Year 
| addtotals fieldname="Total" 2* | eval Org=mvindex(split(RowLabel,"-"),0)| appendpipe [| stats sum(*) as * by Org | eval RowLabel=Org."Z"] 
| sort RowLabel | fields - Org

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Try something like this

your base search giving fields Organization Unit Ticket_state Severity Year Count
| eval RowLabel=Organiation."-".Unit."-".Ticket_state."-".Severity | chart sum(count) as count over RowLabel by Year 
| addtotals fieldname="Total" 2* | eval Org=mvindex(split(RowLabel,"-"),0)| appendpipe [| stats sum(*) as * by Org | eval RowLabel=Org."Z"] 
| sort RowLabel | fields - Org

ishaanshekhar
Communicator

Thanks a lot, somesoni2! Your solution worked nicely and is giving correct results...

However, for some reason the values under RowLabel are coming in one row and are not grouped. And some values under RowLabel column have 'Z' appended in the end.

Please advise. Thank you!

Not able to upload the screenshot, so pasting values here:

RowLabel 2011 2012 2013 2014 2015 Total
Computer Management-Financial Department-3-Active 1 8 9
Science Management-Physics Department-3-Deferred - Other 1 1
Engineering Management-IT Department-3-Queued 1 1
Chemistry ManagementZ 2 9 11

0 Karma

lguinn2
Legend

Take a look at the appendpipe command. I think it will get you started.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...