Dashboards & Visualizations

help to do a pie chart from 2 counts

jip31
Motivator

hello
I use the search below

| inputlookup host.csv 
| lookup PanaBatteryStatus.csv "Hostname00" as host OUTPUT CycleCount00 
| where CycleCount00 > 200 
| stats count as NbHostHealthInf85 
| appendcols 
    [| inputlookup host.csv 
    | stats count as NbIndHost] 
| eval NbHostHealthSup85 = (NbIndHost - NbHostHealthInf85) 
**| table NbHostHealthSup85 NbHostHealthInf85**

Now I want to do a pie chart on NbHostHealthSup85 NbHostHealthInf85 results but it doesnt works
could you help me please??

Tags (1)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@jip31

Try this

Add | transpose after your search.

Sample Search:

| makeresults | eval NbHostHealthSup85=100, NbHostHealthInf85=50 | table NbHostHealthSup85 NbHostHealthInf85 | transpose
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/transpose

View solution in original post

0 Karma

woodcock
Esteemed Legend

Try this:

| inputlookup host.csv 
| lookup PanaBatteryStatus.csv "Hostname00" as host OUTPUT CycleCount00 
| where CycleCount00 > 200 
| stats count as NbHostHealthInf85 
| appendcols 
    [| inputlookup host.csv 
    | stats count as NbIndHost] 
| eval NbHostHealthSup85 = (NbIndHost - NbHostHealthInf85)

| foreach NbHostHealthSup85 NbHostHealthInf85 
    [ eval <<FIELD>> = round(100 * <<FIELD>> / NbIndHost) ] 
| table NbHostHealthSup85 NbHostHealthInf85
| untable foo name value
| fields - foo
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@jip31

Try this

Add | transpose after your search.

Sample Search:

| makeresults | eval NbHostHealthSup85=100, NbHostHealthInf85=50 | table NbHostHealthSup85 NbHostHealthInf85 | transpose
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/transpose

0 Karma

jip31
Motivator

thanks
I didnt know this funtion!!!!!

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 ...