<?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: Distinct count by hour by type in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313280#M93780</link>
    <description>&lt;P&gt;How about this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval hour=strftime(_time,"%H") |
 streamstats time_window=1h dc(vehicle_id) AS dc_vid by vehicle_type|
 timechart max(dc_vid) by vehicle_type fixedrange=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval hour=vehicle_type.":".strftime(_time,"%H") |
 streamstats time_window=1h dc(vehicle_id) AS dc_vid by vehicle_type|
 timechart max(dc_vid) by hour fixedrange=false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 Apr 2017 01:13:06 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-04-06T01:13:06Z</dc:date>
    <item>
      <title>Distinct count by hour by type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313279#M93779</link>
      <description>&lt;P&gt;I currently have a search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval hour=strftime(_time,"%H") |
streamstats time_window=1h dc(vehicle_id) AS dc_vid |
timechart max(dc_vid) by hour fixedrange=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This correctly produces the number of distinct vehicles on a particular route by hour.&lt;/P&gt;

&lt;P&gt;But now assume that there are two different vehicle types: bus and streetcar. So I want to modify the chart to show the same thing, but each bar should be a stacked bar composed of the number of distinct vehicles by &lt;CODE&gt;vehicle_type&lt;/CODE&gt; by hour.&lt;/P&gt;

&lt;P&gt;I've tried all manner of fiddling with the search and I can't seem to get it.&lt;/P&gt;

&lt;P&gt;BTW: the existing search shows each hour as a different colored bar. I don't actually care about that. For the new chart, two colors would be fine (one for each vehicle type in the stacked bar).&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 22:25:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313279#M93779</guid>
      <dc:creator>plucas_splunk</dc:creator>
      <dc:date>2017-04-05T22:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by hour by type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313280#M93780</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval hour=strftime(_time,"%H") |
 streamstats time_window=1h dc(vehicle_id) AS dc_vid by vehicle_type|
 timechart max(dc_vid) by vehicle_type fixedrange=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval hour=vehicle_type.":".strftime(_time,"%H") |
 streamstats time_window=1h dc(vehicle_id) AS dc_vid by vehicle_type|
 timechart max(dc_vid) by hour fixedrange=false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Apr 2017 01:13:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313280#M93780</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-04-06T01:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by hour by type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313281#M93781</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval vehicle_type=case(PUT YOUR STUFF HERE)
| timechart span=1h dc(vehicle_id) AS dc_vid BY vehicle_type
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Apr 2017 02:23:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313281#M93781</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-04-06T02:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by hour by type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313282#M93782</link>
      <description>&lt;P&gt;Neither of those works.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2017 02:42:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313282#M93782</guid>
      <dc:creator>plucas_splunk</dc:creator>
      <dc:date>2017-04-06T02:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by hour by type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313283#M93783</link>
      <description>&lt;P&gt;This pretty much works. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2017 02:46:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313283#M93783</guid>
      <dc:creator>plucas_splunk</dc:creator>
      <dc:date>2017-04-06T02:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct count by hour by type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313284#M93784</link>
      <description>&lt;P&gt;There is value in simplicity, even if it is not a &lt;EM&gt;perfect&lt;/EM&gt; fit.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2017 03:09:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Distinct-count-by-hour-by-type/m-p/313284#M93784</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-04-06T03:09:44Z</dc:date>
    </item>
  </channel>
</rss>

