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!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

New Release | Splunk Cloud Platform 10.1.2507

Hello Splunk Community!We are thrilled to announce the General Availability of Splunk Cloud Platform 10.1.2507 ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...