<?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: Count one column, sum another, display average on a third then display group by columns in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525429#M148284</link>
    <description>&lt;LI-CODE lang="markup"&gt;| makeresults | eval events="V 	System1	Good	34.93	UniqueID1
A	System2	Good	11.94	UniqueID2
V 	System3	Good	6.06	UniqueID3
V 	System2	Bad	13.44	UniqueID4
A	System2	Good	11.94	UniqueID5
V 	System3	Good	6.06	UniqueID6
M	System3	Good	1	UniqueId7"
| rex field=events max_match=0 "(?&amp;lt;events&amp;gt;[^\r\n]+)"
| mvexpand events
| rex field=events max_match=0 "(?&amp;lt;Brand&amp;gt;\S+)\s+(?&amp;lt;SystemId&amp;gt;\S+)\s+(?&amp;lt;ResponseStatus&amp;gt;\S+)\s+(?&amp;lt;Amount&amp;gt;\S+)\s+(?&amp;lt;TRI&amp;gt;\S+)"
| stats count sum(Amount) as Amount by Brand SystemId ResponseStatus
| eventstats sum(Amount) as TotalAmount sum(count) as Total
| eval PercentAmount=100*Amount/TotalAmount
| eval PercentCount=100*count/Total
| fields count, Amount, PercentAmount, PercentCount, Brand, SystemId, ResponseStatus&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 19 Oct 2020 17:11:33 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2020-10-19T17:11:33Z</dc:date>
    <item>
      <title>Count one column, sum another, display average on a third then display group by columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525394#M148259</link>
      <description>&lt;P&gt;Hello;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a bit stuck and looking for assistance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Base query returns the following values: Brand SystemId ResponseStatus Amount UniqueIdentifier&lt;BR /&gt;&lt;BR /&gt;I would like to perform work to make the query return stats on top of it:&lt;BR /&gt;1. Count the UniqueIdentifier in a new column.&lt;BR /&gt;2. Sum the Amount grouping by&amp;nbsp;Brand SystemId ResponseStatus&lt;BR /&gt;3. Percent of Total Sum(Amount) by Brand SystemId ResponseStatus&lt;BR /&gt;4. Percent of Total count(UniqueIdentifier) by&amp;nbsp;Brand SystemId ResponseStatus&lt;BR /&gt;&lt;BR /&gt;Then I would like the final result to appear like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.2.3.4, then Brand SystemId ResponseStatus --&amp;gt; to demonstrate the groupings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In splunk I know I can perform counts, and sum, using a grouping, then sum(counts) by, and create averages. What I can't determine is how to line them all together in a single resultset.&amp;nbsp; Further, if I try to do stats on multiple columns and set it to a new column, it won't accept it (or doing it wrong)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any pointers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 15:23:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525394#M148259</guid>
      <dc:creator>benj851</dc:creator>
      <dc:date>2020-10-19T15:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count one column, sum another, display average on a third then display group by columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525414#M148271</link>
      <description>&lt;P&gt;Can you provide some sample data that could be returned by your basic query and how that might translate into your final result?&lt;/P&gt;&lt;P&gt;Is 1 a count of uniqueids grouping by Brand SystemId ResponseStatus as well?&lt;/P&gt;&lt;P&gt;Does each event have a unique identifier? (That may sound obvious but needs confirming.)&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 16:14:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525414#M148271</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-19T16:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count one column, sum another, display average on a third then display group by columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525418#M148275</link>
      <description>&lt;LI-CODE lang="markup"&gt;-- base query
| stats count sum(Amount) as Amount by Brand SystemId ResponseStatus
| eventstats sum(Amount) as TotalAmount sum(count) as Total
| eval PercentAmount=100*Amount/TotalAmount
| eval PercentCount=100*count/Total
| fields count, Amount, PercentAmount, PercentCount, Brand, SystemId, ResponseStatus&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Oct 2020 16:20:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525418#M148275</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-19T16:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count one column, sum another, display average on a third then display group by columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525425#M148280</link>
      <description>&lt;TABLE width="694"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="165"&gt;Type&lt;/TD&gt;&lt;TD width="133"&gt;SystemId&lt;/TD&gt;&lt;TD width="123"&gt;ResponseStatus&lt;/TD&gt;&lt;TD width="134"&gt;ApprovedAmount&lt;/TD&gt;&lt;TD width="139"&gt;TRI&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165"&gt;V&amp;nbsp;&lt;/TD&gt;&lt;TD width="133"&gt;System1&lt;/TD&gt;&lt;TD width="123"&gt;Good&lt;/TD&gt;&lt;TD width="134"&gt;34.93&lt;/TD&gt;&lt;TD width="139"&gt;UniqueID1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165"&gt;A&lt;/TD&gt;&lt;TD width="133"&gt;System2&lt;/TD&gt;&lt;TD width="123"&gt;Good&lt;/TD&gt;&lt;TD width="134"&gt;11.94&lt;/TD&gt;&lt;TD width="139"&gt;UniqueID2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165"&gt;V&amp;nbsp;&lt;/TD&gt;&lt;TD width="133"&gt;System3&lt;/TD&gt;&lt;TD width="123"&gt;Good&lt;/TD&gt;&lt;TD width="134"&gt;6.06&lt;/TD&gt;&lt;TD width="139"&gt;UniqueID3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165"&gt;V&amp;nbsp;&lt;/TD&gt;&lt;TD width="133"&gt;System2&lt;/TD&gt;&lt;TD width="123"&gt;Bad&lt;/TD&gt;&lt;TD width="134"&gt;13.44&lt;/TD&gt;&lt;TD width="139"&gt;UniqueID4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165"&gt;A&lt;/TD&gt;&lt;TD width="133"&gt;System2&lt;/TD&gt;&lt;TD width="123"&gt;Good&lt;/TD&gt;&lt;TD width="134"&gt;11.94&lt;/TD&gt;&lt;TD width="139"&gt;UniqueID5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165"&gt;V&amp;nbsp;&lt;/TD&gt;&lt;TD width="133"&gt;System3&lt;/TD&gt;&lt;TD width="123"&gt;Good&lt;/TD&gt;&lt;TD width="134"&gt;6.06&lt;/TD&gt;&lt;TD width="139"&gt;UniqueID6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="165"&gt;M&lt;/TD&gt;&lt;TD width="133"&gt;System3&lt;/TD&gt;&lt;TD width="123"&gt;Good&lt;/TD&gt;&lt;TD width="134"&gt;1&lt;/TD&gt;&lt;TD width="139"&gt;UniqueId7&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 19 Oct 2020 16:49:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525425#M148280</guid>
      <dc:creator>benj851</dc:creator>
      <dc:date>2020-10-19T16:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count one column, sum another, display average on a third then display group by columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525429#M148284</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults | eval events="V 	System1	Good	34.93	UniqueID1
A	System2	Good	11.94	UniqueID2
V 	System3	Good	6.06	UniqueID3
V 	System2	Bad	13.44	UniqueID4
A	System2	Good	11.94	UniqueID5
V 	System3	Good	6.06	UniqueID6
M	System3	Good	1	UniqueId7"
| rex field=events max_match=0 "(?&amp;lt;events&amp;gt;[^\r\n]+)"
| mvexpand events
| rex field=events max_match=0 "(?&amp;lt;Brand&amp;gt;\S+)\s+(?&amp;lt;SystemId&amp;gt;\S+)\s+(?&amp;lt;ResponseStatus&amp;gt;\S+)\s+(?&amp;lt;Amount&amp;gt;\S+)\s+(?&amp;lt;TRI&amp;gt;\S+)"
| stats count sum(Amount) as Amount by Brand SystemId ResponseStatus
| eventstats sum(Amount) as TotalAmount sum(count) as Total
| eval PercentAmount=100*Amount/TotalAmount
| eval PercentCount=100*count/Total
| fields count, Amount, PercentAmount, PercentCount, Brand, SystemId, ResponseStatus&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Oct 2020 17:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-one-column-sum-another-display-average-on-a-third-then/m-p/525429#M148284</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-19T17:11:33Z</dc:date>
    </item>
  </channel>
</rss>

