<?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: Struggling with stacked bar chart to show time spent in different places in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Struggling-with-stacked-bar-chart-to-show-time-spent-in/m-p/237759#M188660</link>
    <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source | where Type="Perf" | eval Reference = "(".FlowType."-".SectionType.")" | chart sum(Time) as Time over Reference by SectionName | addtotals fieldname=OTHER | eval OTHER=2*Total - OTHER | fields - Total | table Reference * OTHER
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 08 Mar 2016 17:24:31 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-03-08T17:24:31Z</dc:date>
    <item>
      <title>Struggling with stacked bar chart to show time spent in different places</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Struggling-with-stacked-bar-chart-to-show-time-spent-in/m-p/237758#M188659</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;We are trying to use Splunk to provide some nice diagrams showing execution time of critical sections in reference to total execution time.&lt;/P&gt;

&lt;P&gt;Let's say this is our input:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   Type ="Perf"  Section="TOTAL" FlowType="F1" RequestType="R1" Time="23"
    Type="Perf" Section="A" FlowType="F1" RequestType="R1" Time="3"
    Type="Perf" Section="B" FlowType="F1" RequestType="R1" Time="13"
    Type="Perf" Section="TOTAL" FlowType="F2" RequestType="R2" Time="45"
    Type="Perf" Section="A" FlowType="F2" RequestType="R2" Time="30"
    Type="Perf" Section="B" FlowType="F2" RequestType="R2" Time="3"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What we would like to have is a stacked bar chart, which will be high as value in Total and inside will have a bar for each Section and the difference will shown as OTHER (in case of first 3 rows OTHER = 7)&lt;/P&gt;

&lt;P&gt;So the y axis is time and the x axis is FlowType + RequestType. I am trying different queries but could not get anything yet... any ideas?&lt;/P&gt;

&lt;P&gt;This is hwat I got so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source | where Type="Perf" | 
stats avg(Time) as AvgTime sum(Time) as Time values(Section) as SectionName by Section FlowType RequestType |
eval Reference = "(".FlowType."-".SectionType.")" |
eventstats avg(Time) as "AvgSectionTime" by FlowType RequestType SectionName |
chart values(AvgSectionTime) as Time over Reference by SectionName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is not resolving all the issues, but it generates the stacked bar chart.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
Michal&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 13:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Struggling-with-stacked-bar-chart-to-show-time-spent-in/m-p/237758#M188659</guid>
      <dc:creator>PanKokos</dc:creator>
      <dc:date>2016-03-08T13:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Struggling with stacked bar chart to show time spent in different places</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Struggling-with-stacked-bar-chart-to-show-time-spent-in/m-p/237759#M188660</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source | where Type="Perf" | eval Reference = "(".FlowType."-".SectionType.")" | chart sum(Time) as Time over Reference by SectionName | addtotals fieldname=OTHER | eval OTHER=2*Total - OTHER | fields - Total | table Reference * OTHER
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Mar 2016 17:24:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Struggling-with-stacked-bar-chart-to-show-time-spent-in/m-p/237759#M188660</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-08T17:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Struggling with stacked bar chart to show time spent in different places</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Struggling-with-stacked-bar-chart-to-show-time-spent-in/m-p/237760#M188661</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Clever! &lt;/P&gt;

&lt;P&gt;Also I didn't know that I can directly call fields in eval (e.g. ... | eval SUM = A + B). How I have missed that? This simplified the things a lot! &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 15:05:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Struggling-with-stacked-bar-chart-to-show-time-spent-in/m-p/237760#M188661</guid>
      <dc:creator>PanKokos</dc:creator>
      <dc:date>2016-03-09T15:05:33Z</dc:date>
    </item>
  </channel>
</rss>

