<?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 to create a chart using multiple fields grouped by location in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322508#M96303</link>
    <description>&lt;P&gt;Absolutely!  &lt;/P&gt;

&lt;P&gt;There are a couple of different tricks if you wanted to use this kind of code with multiple levels of breakdown, like _time and Location.  I'll just give you one that you can slot into the above method.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; Your search that returns the relevant event records
 | bin _time span=1d
 | stats sum(Ones) as Ones, sum(Fives) as Fives , ... sum(Hundreds) as Hundreds by _time Location
 | eval combo = "_time="._time." Location=".Location
 | untable combo BillType BillCount
 | rex field=combo "_time=(?&amp;lt;_time&amp;gt;\d+)"
 | rex field=combo "Location=(?&amp;lt;Location&amp;gt;[^$]+)"
 | fields - combo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You now have one record with the &lt;CODE&gt;BillCount&lt;/CODE&gt; for each &lt;CODE&gt;BillType&lt;/CODE&gt; at each &lt;CODE&gt;Location&lt;/CODE&gt; and &lt;CODE&gt;_time&lt;/CODE&gt;, that you can feed to whatever visualization you'd like.&lt;/P&gt;

&lt;P&gt;For instance, you could do this if you wanted to look at only the &lt;CODE&gt;Hundreds&lt;/CODE&gt; across &lt;CODE&gt;_time&lt;/CODE&gt; by &lt;CODE&gt;Location&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where BillType="Hundreds"
| timechart span=1d sum(BillCount) by Location
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you wanted to see the Hundreds and Twenties, you could create a synthetic series name like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where BillType="Hundreds" OR BillType="Twenties"
| eval Location = Location." - ".BillType
| timechart span=1d sum(BillCount) by Location
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 21 Jul 2017 21:49:07 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-07-21T21:49:07Z</dc:date>
    <item>
      <title>How to create a chart using multiple fields grouped by location</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322504#M96299</link>
      <description>&lt;P&gt;I have 6 fields (Ones, Fives, ..., Hundreds). I want to view a chart of the number of bills of each type submitted over the course of the month.  I want to be able to compare the frequency of each type of bill in relation to each other on one column graph.  However, the fields I tagged only show a specific value rather than a range of them. &lt;/P&gt;

&lt;P&gt;I created a tag for each bill (bill_type_ones, bill_type_fives, etc.) For example, my tag &lt;CODE&gt;bill_type_twenties&lt;/CODE&gt;only counts values where the field &lt;CODE&gt;Twenties&lt;/CODE&gt;= 0 so when I &lt;CODE&gt;chart count by tag&lt;/CODE&gt;, it doesn't show the whole range of values.  It actually just shows me the opposite of what I want. Is it possible to set up a tag or some other function that will count any number greater than 0?&lt;/P&gt;

&lt;P&gt;From what I read on tags it looks like it is only possible to tag field-value pairs rather than field- value ranges.  &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322504#M96299</guid>
      <dc:creator>ellenbytech</dc:creator>
      <dc:date>2020-09-29T15:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a chart using multiple fields grouped by location</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322505#M96300</link>
      <description>&lt;P&gt;Could you provide your current search, current output and corresponding expected output?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 20:17:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322505#M96300</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-07-21T20:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a chart using multiple fields grouped by location</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322506#M96301</link>
      <description>&lt;P&gt;You really should delete those tags and set them up correctly.&lt;/P&gt;

&lt;P&gt;However, you probably don't actually want the number of events with Twenties, you want the number of Twenties, so the tags really aren't doing you any good.&lt;/P&gt;

&lt;P&gt;Try this -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your search that returns the relevant event records
| bin _time span=1d
| stats sum(Ones) as Ones, sum(Fives) as Fives , ... sum(Hundreds) as Hundreds by _time
| untable _time BillType BillCount
| timechart span=1d sum(BillCount) as BillCount by BillType
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jul 2017 20:35:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322506#M96301</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-21T20:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a chart using multiple fields grouped by location</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322507#M96302</link>
      <description>&lt;P&gt;Thank you so much! In the mean time I was searching by using NOT tag::*twenties and summing the count of non-zero events that way but that didn't let me have the data on each type of bill to be displayed on one chart.  From here I think I'll be able to divide it by location instead of time myself.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 21:25:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322507#M96302</guid>
      <dc:creator>ellenbytech</dc:creator>
      <dc:date>2017-07-21T21:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a chart using multiple fields grouped by location</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322508#M96303</link>
      <description>&lt;P&gt;Absolutely!  &lt;/P&gt;

&lt;P&gt;There are a couple of different tricks if you wanted to use this kind of code with multiple levels of breakdown, like _time and Location.  I'll just give you one that you can slot into the above method.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; Your search that returns the relevant event records
 | bin _time span=1d
 | stats sum(Ones) as Ones, sum(Fives) as Fives , ... sum(Hundreds) as Hundreds by _time Location
 | eval combo = "_time="._time." Location=".Location
 | untable combo BillType BillCount
 | rex field=combo "_time=(?&amp;lt;_time&amp;gt;\d+)"
 | rex field=combo "Location=(?&amp;lt;Location&amp;gt;[^$]+)"
 | fields - combo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You now have one record with the &lt;CODE&gt;BillCount&lt;/CODE&gt; for each &lt;CODE&gt;BillType&lt;/CODE&gt; at each &lt;CODE&gt;Location&lt;/CODE&gt; and &lt;CODE&gt;_time&lt;/CODE&gt;, that you can feed to whatever visualization you'd like.&lt;/P&gt;

&lt;P&gt;For instance, you could do this if you wanted to look at only the &lt;CODE&gt;Hundreds&lt;/CODE&gt; across &lt;CODE&gt;_time&lt;/CODE&gt; by &lt;CODE&gt;Location&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where BillType="Hundreds"
| timechart span=1d sum(BillCount) by Location
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you wanted to see the Hundreds and Twenties, you could create a synthetic series name like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where BillType="Hundreds" OR BillType="Twenties"
| eval Location = Location." - ".BillType
| timechart span=1d sum(BillCount) by Location
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jul 2017 21:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-chart-using-multiple-fields-grouped-by-location/m-p/322508#M96303</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-07-21T21:49:07Z</dc:date>
    </item>
  </channel>
</rss>

