<?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 How to group different values and count the number of transactions? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-different-values-and-count-the-number-of/m-p/293583#M88625</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I have 2 data sources (source 1 and source 2) with different locations and transactions.&lt;BR /&gt;
How can I group the locations to Inbound and Outbound and count the transactions?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Source 1
Location        Transaction
Location/dock/1     ok
Location/rec/1      ok
Location/pack/1     ok
Location/ship/1     ok


Source 2
Location        Transaction
Location/dock/1     not ok
Location/rec/1      not ok
Location/pack/1     not ok
Location/ship/1     not ok

Groupings
Inbound = Location/dock/1 , Location/rec/1  
Outbound = Location/pack/1, Location/ship/1

Result
Location       Ok   not ok
Inbound     2          2
Outbound        2          2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 14 Feb 2018 08:16:29 GMT</pubDate>
    <dc:creator>auaave</dc:creator>
    <dc:date>2018-02-14T08:16:29Z</dc:date>
    <item>
      <title>How to group different values and count the number of transactions?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-different-values-and-count-the-number-of/m-p/293583#M88625</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I have 2 data sources (source 1 and source 2) with different locations and transactions.&lt;BR /&gt;
How can I group the locations to Inbound and Outbound and count the transactions?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Source 1
Location        Transaction
Location/dock/1     ok
Location/rec/1      ok
Location/pack/1     ok
Location/ship/1     ok


Source 2
Location        Transaction
Location/dock/1     not ok
Location/rec/1      not ok
Location/pack/1     not ok
Location/ship/1     not ok

Groupings
Inbound = Location/dock/1 , Location/rec/1  
Outbound = Location/pack/1, Location/ship/1

Result
Location       Ok   not ok
Inbound     2          2
Outbound        2          2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Feb 2018 08:16:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-different-values-and-count-the-number-of/m-p/293583#M88625</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-14T08:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to group different values and count the number of transactions?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-different-values-and-count-the-number-of/m-p/293584#M88626</link>
      <description>&lt;P&gt;Hi @auaave ,&lt;BR /&gt;
Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH | | eval Location=case(like(Location,"%dock%") OR like(Location,"%rec%"),"Inbound",like(Location,"%pack%") OR like(Location,"%ship%"),"Outbound") | chart count over Location by  Transaction
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My Sample Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval Location="Location/dock/1,Location/rec/1,Location/pack/1,Location/ship/1" | eval Location=split(Location,",")| mvexpand Location | eval Transaction="ok" | append [| makeresults | eval Location="Location/dock/1,Location/rec/1,Location/pack/1,Location/ship/1" | eval Location=split(Location,",")| mvexpand Location | eval Transaction="not ok"] | eval Location=case(like(Location,"%dock%") OR like(Location,"%rec%"),"Inbound",like(Location,"%pack%") OR like(Location,"%ship%"),"Outbound") | chart count over Location by  Transaction
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 10:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-different-values-and-count-the-number-of/m-p/293584#M88626</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-02-14T10:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to group different values and count the number of transactions?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-group-different-values-and-count-the-number-of/m-p/293585#M88627</link>
      <description>&lt;P&gt;@kamlesh_vaghela, thanks for your help! The groupings works well but I changed the last part to take into account the 2 types of sources.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 22:31:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-group-different-values-and-count-the-number-of/m-p/293585#M88627</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-02-14T22:31:40Z</dc:date>
    </item>
  </channel>
</rss>

