<?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: Charting values are not right in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325414#M21022</link>
    <description>&lt;P&gt;@johnblakely - glad you got your answer from the inestimable @cmerriman.  &lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2017 14:52:46 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-10-25T14:52:46Z</dc:date>
    <item>
      <title>Charting values are not right</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325409#M21017</link>
      <description>&lt;P&gt;I'm seeing a weird problem that I've been banging my head on today. I have the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="tap" eventType="messagesDelivered" OR eventType="messagesBlocked" | stats count(eval(eventType=="messagesBlocked")) AS Blocked, count(eval(eventType=="messagesDelivered")) AS Delivered | eval Total=(Blocked+Delivered) | eval divided = Blocked/Total | eval Percent_Blocked=round((divided*100),0)."%" | fields Blocked,Delivered,Total,Percent_Blocked
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The search works fine, but it charts only the Blocked field and nothing else, so my pie chart is 100% Blocked and a single color. I'm wanting to chart the blocked and delivered as separate slices.  I think it has something to do with my stats and eval command renaming. &lt;/P&gt;

&lt;P&gt;The original data are from the field eventType. If I don't eval them to different fields, they show up as individual rows instead of columns - but this works:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3710i2754A35EBD54A63E/image-size/large?v=v2&amp;amp;px=999" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;If I do the original search with stats and eval, I get this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3711i45759BEF8B86D76E/image-size/large?v=v2&amp;amp;px=999" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Any ideas on how I can chart this based off of the Blocked and Delivered columns?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 22:02:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325409#M21017</guid>
      <dc:creator>johnblakley</dc:creator>
      <dc:date>2017-10-24T22:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Charting values are not right</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325410#M21018</link>
      <description>&lt;P&gt;I don’t think you’re going to be able to put that original search into a pie chart. Why do you need them in separate columns? Is it just for the total and percentage calculations? You can try &lt;CODE&gt;...|eventstats sum(count) as total|eval Percent=round((count/total)*100,0)."%"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 01:00:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325410#M21018</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-10-25T01:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Charting values are not right</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325411#M21019</link>
      <description>&lt;P&gt;You are doing too much work &lt;STRONG&gt;&lt;EM&gt;for&lt;/EM&gt;&lt;/STRONG&gt; the system.  Get lazier.&lt;/P&gt;

&lt;P&gt;Try this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="tap" eventType="messagesDelivered" OR eventType="messagesBlocked" 
| stats count by eventType
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That should give you two records.  Drop it into the pie chart, and you should get two slices on the pie.&lt;/P&gt;

&lt;P&gt;If you want to clean up the names a little, add these two...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed field=eventType "s/messages//g"
| rename eventType as Type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;... and you can also add this for some additional options&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| chart sum(count) by Type
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Oct 2017 01:08:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325411#M21019</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-10-25T01:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Charting values are not right</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325412#M21020</link>
      <description>&lt;P&gt;This is how I received the chart at the top - minus cleaning it with sed. With this search though, I'm unable to show the % in the chart. Is there a way to chart messagesDelivered and messagesBlocked only, and still allow a 3rd row for Percentage (but not chart it).&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 13:00:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325412#M21020</guid>
      <dc:creator>johnblakley</dc:creator>
      <dc:date>2017-10-25T13:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Charting values are not right</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325413#M21021</link>
      <description>&lt;P&gt;Thanks! I was able to add this to the original search (with help from DalJeanis) and come up with a perfect chart with percentages. I'm not able to upload a screenshot to a comment, but here's the final search below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="tap" eventType="messagesDelivered" OR eventType="messagesBlocked" | stats count by eventType | rex mode=sed field=eventType "s/messages//g" | eventstats sum(count) as total|eval Percent=round((count/total)*100,0)."%" | rename eventType as Type, count as Totals | fields Type, Totals, Percent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Oct 2017 13:10:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325413#M21021</guid>
      <dc:creator>johnblakley</dc:creator>
      <dc:date>2017-10-25T13:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Charting values are not right</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325414#M21022</link>
      <description>&lt;P&gt;@johnblakely - glad you got your answer from the inestimable @cmerriman.  &lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 14:52:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-values-are-not-right/m-p/325414#M21022</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-10-25T14:52:46Z</dc:date>
    </item>
  </channel>
</rss>

