<?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 count the same values over different fields together? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691123#M235364</link>
    <description>&lt;P&gt;A little update:&lt;/P&gt;
&lt;P&gt;I now got to a point where I have the following situation:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Fruit_1 count Fruit_2 count

Apple 5 null null

Orange 10 null null

Pear 5 Apple 5

Melon 10 Orange 10&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;How do I get it so that the amount of apples and oranges from column Fruit_1 and Fruit_2 are combined into 1 big fruit list and 1 count list?

So the result should be:

Fruit Count

Apple 10

Orange 20

Pear 5

Melon 5&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 19 Jun 2024 23:47:26 GMT</pubDate>
    <dc:creator>RonWonkers</dc:creator>
    <dc:date>2024-06-19T23:47:26Z</dc:date>
    <item>
      <title>How to count the same values over different fields together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691105#M235359</link>
      <description>&lt;P&gt;Lets say we have the following data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Fruit_ID Fruit_1 Fruit_2

1 Apple NULL

2 Apple NULL

3 Apple NULL

4 Orange NULL

5 Orange NULL

6 Orange NULL

7 Apple Orange

8 Apple Orange

9 Apple Orange

10 Apple Orange&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I am trying to count the total amount of every fruit, in the above example it should be 7 apples and 7 oranges, the problem is that these fruits are seperated in 2 different columns because a fruit name can be both an apple AND an orange, how do I deal with this when counting the total amount of fruit?&lt;/P&gt;
&lt;P&gt;Counting one at a time works:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| stats count by Fruit_1&lt;/LI-CODE&gt;
&lt;P&gt;But how do I count both to give a total number since they are 2 seperate columns&lt;/P&gt;
&lt;P&gt;I tried combining both columns so its all in 1 long list of values in 1 column but I could not get a definitive answer on how to do this. I tried appending results so first count Fruit_1, then append count Fruit_2 but I did not get the right result of Apple: 7 Orange: 7. Its either 1 or the other.&lt;/P&gt;
&lt;P&gt;Does anybody have a fix for how to count over multiple fields like this and combine the result together in 1 field?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 16:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691105#M235359</guid>
      <dc:creator>RonWonkers</dc:creator>
      <dc:date>2024-06-19T16:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the same values over different fields together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691106#M235360</link>
      <description>&lt;P&gt;For context: this question is regarding use cases/user stories for Splunk.&lt;/P&gt;&lt;P&gt;A use case can be linked to multiple user stories, and I want to count the amount of total user stories.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 14:34:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691106#M235360</guid>
      <dc:creator>RonWonkers</dc:creator>
      <dc:date>2024-06-19T14:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the same values over different fields together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691123#M235364</link>
      <description>&lt;P&gt;A little update:&lt;/P&gt;
&lt;P&gt;I now got to a point where I have the following situation:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Fruit_1 count Fruit_2 count

Apple 5 null null

Orange 10 null null

Pear 5 Apple 5

Melon 10 Orange 10&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;How do I get it so that the amount of apples and oranges from column Fruit_1 and Fruit_2 are combined into 1 big fruit list and 1 count list?

So the result should be:

Fruit Count

Apple 10

Orange 20

Pear 5

Melon 5&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 Jun 2024 23:47:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691123#M235364</guid>
      <dc:creator>RonWonkers</dc:creator>
      <dc:date>2024-06-19T23:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the same values over different fields together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691124#M235365</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval fruit=mvappend(fruit1,if(fruit2!="NULL",fruit2,null()))
| stats count by fruit&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 Jun 2024 17:27:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691124#M235365</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-19T17:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the same values over different fields together?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691125#M235366</link>
      <description>&lt;P&gt;Thank you! Just like that it works and only in 1 line &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 17:31:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-same-values-over-different-fields-together/m-p/691125#M235366</guid>
      <dc:creator>RonWonkers</dc:creator>
      <dc:date>2024-06-19T17:31:11Z</dc:date>
    </item>
  </channel>
</rss>

