<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Pie chart show 0 results in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442650#M41463</link>
    <description>&lt;P&gt;Here's a trick to how to think about splunk... &lt;CODE&gt;chart&lt;/CODE&gt; is a presentation command.  When you are having trouble making it do what you want, then back up and do the calculation with &lt;CODE&gt;stats&lt;/CODE&gt;, then present the data after you are done with the statistical manipulation. &lt;/P&gt;

&lt;P&gt;In this case, &lt;CODE&gt;chart&lt;/CODE&gt; is taking you the wrong direction. You immediately transposed the result, meaning you didn't want it presented sideways anyway.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="customer_summary_info"
| fields event_category_*
| stats sum(event_category_*) as cat_* by index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you have a single record with all your event categories summarized.... pretty much the same as &lt;CODE&gt;chart&lt;/CODE&gt; gave you. To get rid of categories with zero results, there's a trick with &lt;CODE&gt;untable&lt;/CODE&gt;.  (That's why I left another field in there, &lt;CODE&gt;index&lt;/CODE&gt;, although it might as well have been called &lt;CODE&gt;dummy&lt;/CODE&gt;) &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| untable index Category Sum
| where Sum&amp;gt;0
| fields - index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You now have one record per non-zero Category, with "cat_*" in the field named Category, and the sum in the field named Sum.  This should provide what you need for your pie chart.    &lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 14:16:18 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2018-06-11T14:16:18Z</dc:date>
    <item>
      <title>Pie chart show 0 results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442649#M41462</link>
      <description>&lt;P&gt;i have in issue with my pie chart&lt;BR /&gt;
query:&lt;BR /&gt;
index="customer_summary_info" | chart sum(event_category_*)  | transpose&lt;/P&gt;

&lt;P&gt;my pie show also the 0 results in the pie which is confusing&lt;BR /&gt;
tried cont=false but it's not working&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442649#M41462</guid>
      <dc:creator>mcohen13</dc:creator>
      <dc:date>2020-09-29T19:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pie chart show 0 results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442650#M41463</link>
      <description>&lt;P&gt;Here's a trick to how to think about splunk... &lt;CODE&gt;chart&lt;/CODE&gt; is a presentation command.  When you are having trouble making it do what you want, then back up and do the calculation with &lt;CODE&gt;stats&lt;/CODE&gt;, then present the data after you are done with the statistical manipulation. &lt;/P&gt;

&lt;P&gt;In this case, &lt;CODE&gt;chart&lt;/CODE&gt; is taking you the wrong direction. You immediately transposed the result, meaning you didn't want it presented sideways anyway.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="customer_summary_info"
| fields event_category_*
| stats sum(event_category_*) as cat_* by index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you have a single record with all your event categories summarized.... pretty much the same as &lt;CODE&gt;chart&lt;/CODE&gt; gave you. To get rid of categories with zero results, there's a trick with &lt;CODE&gt;untable&lt;/CODE&gt;.  (That's why I left another field in there, &lt;CODE&gt;index&lt;/CODE&gt;, although it might as well have been called &lt;CODE&gt;dummy&lt;/CODE&gt;) &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| untable index Category Sum
| where Sum&amp;gt;0
| fields - index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You now have one record per non-zero Category, with "cat_*" in the field named Category, and the sum in the field named Sum.  This should provide what you need for your pie chart.    &lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:16:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442650#M41463</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-06-11T14:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pie chart show 0 results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442651#M41464</link>
      <description>&lt;P&gt;i changed the query:&lt;BR /&gt;
index="customer_summary_info" | fields event_category_* | stats sum(event_category_&lt;EM&gt;) as "cat_&lt;/EM&gt;" by Dummy | untable Dummy Category Sum | where Sum&amp;gt;0 | fields - Dummy&lt;BR /&gt;
and now it show no results at all&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:53:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442651#M41464</guid>
      <dc:creator>mcohen13</dc:creator>
      <dc:date>2020-09-29T19:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Pie chart show 0 results</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442652#M41465</link>
      <description>&lt;P&gt;removed the "by Dummy" and now it works&lt;BR /&gt;
thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 15:43:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Pie-chart-show-0-results/m-p/442652#M41465</guid>
      <dc:creator>mcohen13</dc:creator>
      <dc:date>2018-06-11T15:43:20Z</dc:date>
    </item>
  </channel>
</rss>

