<?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 results by a _time bucket and a calculated percentage of a count of events flagged in the bucket (in separate series on one chart) in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-results-by-a-time-bucket-and-a-calculated-percentage-of/m-p/346160#M22551</link>
    <description>&lt;P&gt;how about this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|bucket _time span=1h|stats count(eval(flag="GREEN")) as GREEN count(eval(flag="RED")) as RED by _time location_code|eval percentage=round(GREEN/(GREEN+RED)*100,2)|fields - GREEN RED|eval {location_code}=percentage|fields - location_code percentage|stats values(*) as * by _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i worked off of this and it seemed to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval data="time=1506011682,location_code=A,flag=GREEN time=1506011682,location_code=A,flag=GREEN time=1506011682,location_code=A,flag=RED time=1506011682,location_code=B,flag=RED time=1506011682,location_code=C,flag=GREEN time=1506011682,location_code=C,flag=GREEN time=1506000882,location_code=A,flag=RED time=1506000882,location_code=A,flag=GREEN time=1506000882,location_code=A,flag=GREEN time=1506000882,location_code=B,flag=RED time=1506000882,location_code=C,flag=GREEN time=1506000882,location_code=C,flag=RED"|makemv data|mvexpand data|eval _raw=data|kv|eval _time=time|bucket _time span=1h|table _time location_code flag|stats count(eval(flag="GREEN")) as GREEN count(eval(flag="RED")) as RED by _time location_code|eval percentage=round(GREEN/(GREEN+RED)*100,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Sep 2017 11:43:00 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2017-09-22T11:43:00Z</dc:date>
    <item>
      <title>Charting results by a _time bucket and a calculated percentage of a count of events flagged in the bucket (in separate series on one chart)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-results-by-a-time-bucket-and-a-calculated-percentage-of/m-p/346159#M22550</link>
      <description>&lt;P&gt;I have stats results from a search which form what amounts to a transaction per row on the order of several thousands of rows per hour.  The transaction has relevant for this chart the following:  _time, a flag "RED" or "GREEN", and a location code which is one of several codes.  I want to bin _time  by the hour and display a percentage as GREEN/(RED+GREEN) on a line graph with a line for each location in the series.  This basically calculates the performance per location based on a percentage on the hour over time.  I've tried several things and it's just not working, so maybe someone can shortcut me here.&lt;/P&gt;

&lt;P&gt;simplified example for a time bucket 12345:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time        location_code     flag
12345        A                GREEN
12345        A                GREEN
12345        A                RED
12345        B                RED
12345        C                GREEN
12345        C                GREEN
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 02:29:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-results-by-a-time-bucket-and-a-calculated-percentage-of/m-p/346159#M22550</guid>
      <dc:creator>luminarycrush</dc:creator>
      <dc:date>2017-09-22T02:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Charting results by a _time bucket and a calculated percentage of a count of events flagged in the bucket (in separate series on one chart)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-results-by-a-time-bucket-and-a-calculated-percentage-of/m-p/346160#M22551</link>
      <description>&lt;P&gt;how about this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|bucket _time span=1h|stats count(eval(flag="GREEN")) as GREEN count(eval(flag="RED")) as RED by _time location_code|eval percentage=round(GREEN/(GREEN+RED)*100,2)|fields - GREEN RED|eval {location_code}=percentage|fields - location_code percentage|stats values(*) as * by _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i worked off of this and it seemed to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval data="time=1506011682,location_code=A,flag=GREEN time=1506011682,location_code=A,flag=GREEN time=1506011682,location_code=A,flag=RED time=1506011682,location_code=B,flag=RED time=1506011682,location_code=C,flag=GREEN time=1506011682,location_code=C,flag=GREEN time=1506000882,location_code=A,flag=RED time=1506000882,location_code=A,flag=GREEN time=1506000882,location_code=A,flag=GREEN time=1506000882,location_code=B,flag=RED time=1506000882,location_code=C,flag=GREEN time=1506000882,location_code=C,flag=RED"|makemv data|mvexpand data|eval _raw=data|kv|eval _time=time|bucket _time span=1h|table _time location_code flag|stats count(eval(flag="GREEN")) as GREEN count(eval(flag="RED")) as RED by _time location_code|eval percentage=round(GREEN/(GREEN+RED)*100,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Sep 2017 11:43:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Charting-results-by-a-time-bucket-and-a-calculated-percentage-of/m-p/346160#M22551</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-09-22T11:43:00Z</dc:date>
    </item>
  </channel>
</rss>

