Dashboards & Visualizations

How to create a pie chart with specific field values?

russell120
Communicator

Hi, here is a sample lookup file's table/csv:

sample.csv

Animal  Color
horse    black
horse    Grey
horse    Orange
horse    Grey
horse    Grey

How can I display ONLY the colors black vs. grey in a pie chart with their respective percentages? My below code only shows a single-colored pie chart and their count.

|inputlookup sample.csv
|chart
   count(eval(color = "black" )) as Noir
   count(eval(color = "grey")) as Gris
0 Karma
1 Solution

harishalipaka
Motivator

Hi @russell120

|inputlookup sample.csv |where Color in ("black","grey") |stats count by color

If my answer helped pls upvote or accept as answer.

Thanks
Harish

View solution in original post

0 Karma

harishalipaka
Motivator

Hi @russell120

|inputlookup sample.csv |where Color in ("black","grey") |stats count by color

If my answer helped pls upvote or accept as answer.

Thanks
Harish
0 Karma

russell120
Communicator

@harishalipaka This allows a table to be shown where Color are either of those values, but when I select the Pie Char visulization button, there are no results. The empty grey pie chart says Numeric Data Required.

0 Karma

russell120
Communicator

Nevermind! I added

|stats count by Color

to the end and it worked!

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...