<?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 count unique values in a multi value field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339493#M100680</link>
    <description>&lt;P&gt;That appears to have worked but why?&lt;BR /&gt;
If &lt;BR /&gt;
cat= FFIEC; PPI&lt;BR /&gt;
and &lt;BR /&gt;
cat= PPI&lt;/P&gt;

&lt;P&gt;There is no ; or " " on the second value so why would the "; " be any different than ";"?&lt;/P&gt;</description>
    <pubDate>Tue, 17 Apr 2018 14:37:11 GMT</pubDate>
    <dc:creator>aarontmartin165</dc:creator>
    <dc:date>2018-04-17T14:37:11Z</dc:date>
    <item>
      <title>How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339487#M100674</link>
      <description>&lt;P&gt;I have a field &lt;EM&gt;cat&lt;/EM&gt; which may display multiple fields of varying count &lt;EM&gt;FFIEC, GLBA, PPI&lt;/EM&gt; or just &lt;EM&gt;PPI&lt;/EM&gt; so there is no set count to the multivalue fields.  I am attempting to count the number of times each unique value appears and graph it over time.  My query is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my query | eval Policies=split(cat,";") | timechart span=1h count by Policies
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My problem is that when the line chart is displayed there can be multiple lines for a &lt;EM&gt;Policy&lt;/EM&gt; value. For example if the multivalue field returns 3 instances as follows&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;FFIEC; GLBA; PPI&lt;BR /&gt;
PPI&lt;BR /&gt;
PPI&lt;BR /&gt;
FFIEC; GLBA; PPI&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;My line values would display PPI = 2 FFIEC = 2 GLBA= 2 PPI = 2&lt;/P&gt;

&lt;P&gt;What I am hoping to achieve is PPI=4 FFIEC=2 GLBA=2&lt;/P&gt;

&lt;P&gt;Can anyone identify the part of my query I have wrong?  &lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 13:38:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339487#M100674</guid>
      <dc:creator>aarontmartin165</dc:creator>
      <dc:date>2018-04-17T13:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339488#M100675</link>
      <description>&lt;P&gt;what happens if you just mvexpand on policies before the timechart?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 13:44:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339488#M100675</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-04-17T13:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339489#M100676</link>
      <description>&lt;P&gt;You should try adding a space in your split separator:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my query | eval Policies=split(cat,"; ") | timechart span=1h count by Policies
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Apr 2018 13:46:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339489#M100676</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2018-04-17T13:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339490#M100677</link>
      <description>&lt;P&gt;Can you try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my query | eval To_count=mvcount(split(cat,"; "))-1  | timechart span=1h values(To_count) by Policies
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Apr 2018 13:47:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339490#M100677</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-04-17T13:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339491#M100678</link>
      <description>&lt;P&gt;Use &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.3/SearchReference/Mvexpand"&gt;mvexpand&lt;/A&gt; to create an event for each multi value value. You'll be able create a timechart with a line for each distict policy:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my query 
| eval Policies=split(cat,";") 
| mvexpand Policies
| timechart span=1h count by Policies
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Apr 2018 14:07:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339491#M100678</guid>
      <dc:creator>evsmt</dc:creator>
      <dc:date>2018-04-17T14:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339492#M100679</link>
      <description>&lt;P&gt;Why would I use the -1?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 14:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339492#M100679</guid>
      <dc:creator>aarontmartin165</dc:creator>
      <dc:date>2018-04-17T14:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339493#M100680</link>
      <description>&lt;P&gt;That appears to have worked but why?&lt;BR /&gt;
If &lt;BR /&gt;
cat= FFIEC; PPI&lt;BR /&gt;
and &lt;BR /&gt;
cat= PPI&lt;/P&gt;

&lt;P&gt;There is no ; or " " on the second value so why would the "; " be any different than ";"?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 14:37:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339493#M100680</guid>
      <dc:creator>aarontmartin165</dc:creator>
      <dc:date>2018-04-17T14:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339494#M100681</link>
      <description>&lt;P&gt;split function will create a value for the multivalve field overtime it meets the splitter.&lt;BR /&gt;
So, in first case "cat=FFIEC; PPI" it will return "FFIEC" and " PPI" if you use ";"&lt;BR /&gt;
In second case it will just return "PPI" because nothing to split.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 14:45:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339494#M100681</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2018-04-17T14:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count unique values in a multi value field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339495#M100682</link>
      <description>&lt;P&gt;Got it, I was thinking that leading spaces would be dropped but as I read your explanation I realize I had no reason I should have expected that.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 15:13:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-unique-values-in-a-multi-value-field/m-p/339495#M100682</guid>
      <dc:creator>aarontmartin165</dc:creator>
      <dc:date>2018-04-17T15:13:57Z</dc:date>
    </item>
  </channel>
</rss>

