<?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 combine duplicate multiple rows into one row in a table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-duplicate-multiple-rows-into-one-row-in-a-table/m-p/608097#M211438</link>
    <description>&lt;PRE&gt;&lt;SPAN&gt;| stats count as Result by Customer, ErrorCode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval PercentOfTotal=100&lt;BR /&gt;| addcoltotals Result&lt;BR /&gt;|fillnull 'Error Code' value="Total"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can sum up your counts with the addcoltotals command as shown above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2022 14:36:57 GMT</pubDate>
    <dc:creator>martinpu</dc:creator>
    <dc:date>2022-08-03T14:36:57Z</dc:date>
    <item>
      <title>How to combine duplicate multiple rows into one row in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-duplicate-multiple-rows-into-one-row-in-a-table/m-p/608094#M211436</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;
&lt;P&gt;I have a data as follows -&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Customer&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Error Code&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Abc&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;1111&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Abc&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;1111&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Abc&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;1222&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;4&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Abc&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Total&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;4&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Abc&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;Total&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="207"&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to combine the Total into single row Total showing the result column as - Total : 9.&lt;/P&gt;
&lt;P&gt;My code now -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;| stats count as Result by Customer, ErrorCode&lt;BR /&gt;| eval PercentOfTotal=100&lt;BR /&gt;| append&lt;BR /&gt;[search index=sourcetype= abc: source= */ABC/* ErrorCode!=0&lt;BR /&gt;| stats count as Result by Customer&lt;BR /&gt;| eval ErrorCode="Total", PercentOfTotal=100]&lt;BR /&gt;| lookup xyz ErrorCode OUTPUT Description&lt;BR /&gt;| lookup pqr Customer OUTPUT Customer_Name&lt;BR /&gt;| eval Customer_Name=coalesce(Customer_Name,Customer)&lt;BR /&gt;| eval Error=if(ErrorCode!="Total", ErrorCode+" ("+coalesce(Description,"Description Missing - Update xyz")+")", ErrorCode)&lt;BR /&gt;| fields CustomerName, Error, Result&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 14:34:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-duplicate-multiple-rows-into-one-row-in-a-table/m-p/608094#M211436</guid>
      <dc:creator>wanda619</dc:creator>
      <dc:date>2022-08-03T14:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine duplicate multiple rows into one row in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-duplicate-multiple-rows-into-one-row-in-a-table/m-p/608097#M211438</link>
      <description>&lt;PRE&gt;&lt;SPAN&gt;| stats count as Result by Customer, ErrorCode&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval PercentOfTotal=100&lt;BR /&gt;| addcoltotals Result&lt;BR /&gt;|fillnull 'Error Code' value="Total"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You can sum up your counts with the addcoltotals command as shown above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 14:36:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-duplicate-multiple-rows-into-one-row-in-a-table/m-p/608097#M211438</guid>
      <dc:creator>martinpu</dc:creator>
      <dc:date>2022-08-03T14:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine duplicate multiple rows into one row in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-duplicate-multiple-rows-into-one-row-in-a-table/m-p/608099#M211440</link>
      <description>&lt;P&gt;I'm sure there will be a better option than this but without knowing your data, it would be difficult to suggest that. Try to add following to your current search(at the end):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Your current search
| fields CustomerName, Error, Result
| stats sum(Result) as Result by CustomerName, Error&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 03 Aug 2022 14:41:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-duplicate-multiple-rows-into-one-row-in-a-table/m-p/608099#M211440</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-08-03T14:41:05Z</dc:date>
    </item>
  </channel>
</rss>

