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
Get Updates on the Splunk Community!

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...