<?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: How do I add an additional calculation to a chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243978#M72604</link>
    <description>&lt;P&gt;Hello sunhareshr.  This works, but adds a new column for each value of FIELD3 instead of just adding one.  There is no difference between &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | eventstats dc(field4) as dc_f4 by field2 | chart avg(field1) as average values(dc_f4) as dist_count over field2 by field3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | eventstats dc(field4) as dc_f4 by field2 | chart avg(field1) as average values(dc_f4) as dist_count by field2, field3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any ideas?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2016 06:25:52 GMT</pubDate>
    <dc:creator>andrewtrobec</dc:creator>
    <dc:date>2016-11-22T06:25:52Z</dc:date>
    <item>
      <title>How do I add an additional calculation to a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243974#M72600</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have two separate chart calculations that I would like to combine into a single chart.  The first is an avg calculation on a field grouped by two fields while the second is a distinct_count calculation on another field grouped by one field.  So assuming a have four different fields, the two separate chart commands are:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart avg(FIELD1) by FIELD2, FIELD3
chart distinct_count(FIELD4) by FIELD2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am trying to combine them so that the distinct_count ends up as the final column of the generated table.  I have tried using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart avg(FIELD1) distinct_count(FIELD4) by FIELD2, FIELD3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but all that accomplishes is splitting the distinct_count over FIELD3 as well, which is what I don't want.&lt;/P&gt;

&lt;P&gt;Is there a way of combining the two so that the distinct_count appears as a column at the end being grouped by FIELD2?&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 22:53:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243974#M72600</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2016-11-21T22:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add an additional calculation to a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243975#M72601</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;somesearch | chart avg(FIELD1) by FIELD2, FIELD3 | append [search somesearch | chart distinct_count(FIELD4) by FIELD2]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Nov 2016 23:01:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243975#M72601</guid>
      <dc:creator>bshuler_splunk</dc:creator>
      <dc:date>2016-11-21T23:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add an additional calculation to a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243976#M72602</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;P&gt;*&lt;STRONG&gt;&lt;EM&gt;UPDATED&lt;/EM&gt;&lt;/STRONG&gt;*&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | eventstats dc(field4) as dc_f4 by field2 | eval field2= field2."#".dc_f4 | chart avg(field1) as average over field2 by field3 | rex field=field2 "(?&amp;lt;field2&amp;gt;[^#]+)#(?&amp;lt;distinct_count&amp;gt;.*)" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Nov 2016 00:12:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243976#M72602</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-11-22T00:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add an additional calculation to a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243977#M72603</link>
      <description>&lt;P&gt;Thanks bshuler.  The append command adds a new column to the chart, but the values are appended at the bottom as an entire new table.  So basically the first half of the table is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart avg(FIELD1) by FIELD2, FIELD3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with the distinct_count column blank, while the second half of the table is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;chart distinct_count(FIELD4) by FIELD2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;with all the avg columns blank.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 06:18:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243977#M72603</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2016-11-22T06:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add an additional calculation to a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243978#M72604</link>
      <description>&lt;P&gt;Hello sunhareshr.  This works, but adds a new column for each value of FIELD3 instead of just adding one.  There is no difference between &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | eventstats dc(field4) as dc_f4 by field2 | chart avg(field1) as average values(dc_f4) as dist_count over field2 by field3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | eventstats dc(field4) as dc_f4 by field2 | chart avg(field1) as average values(dc_f4) as dist_count by field2, field3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any ideas?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 06:25:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243978#M72604</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2016-11-22T06:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add an additional calculation to a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243979#M72605</link>
      <description>&lt;P&gt;Try the updated query&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 08:53:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243979#M72605</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-11-22T08:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add an additional calculation to a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243980#M72606</link>
      <description>&lt;P&gt;Thanks, this works!  I will do some reverse engineering to figure out the logic behind it.  I appreciate your help!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 11:26:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/243980#M72606</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2016-11-22T11:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add an additional calculation to a chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/571195#M199034</link>
      <description>&lt;P&gt;Hi Sundareshr, i got this problem, i want to add value 1 to 2 and remove the Shift0, do you have any solution? Thanks&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.png" style="width: 995px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16449i1CCDF870DD12A548/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled.png" alt="Untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 02:54:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-add-an-additional-calculation-to-a-chart/m-p/571195#M199034</guid>
      <dc:creator>lnn2204</dc:creator>
      <dc:date>2021-10-16T02:54:19Z</dc:date>
    </item>
  </channel>
</rss>

