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!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

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