<?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: Is there way to group columns of a table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259207#M77699</link>
    <description>&lt;P&gt;No, but it can be done transposed like this:&lt;/P&gt;

&lt;P&gt;This fakes the base data (you have a base search for this):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS Environment
|eval Environment="Prod,Dev,Test"|makemv delim="," Environment|mvexpand Environment
|eval Phase="Phase1,Phase2,Phase3"|makemv delim="," Phase|mvexpand Phase
|eval Severity=case((Environment="Prod"), "Sev1,Sev1,Sev1,Sev1,Sev2,Sev2,Sev2,Sev2,Sev2,Sev3,Sev3,Sev3,Sev3",
                    (Environment="Dev"), "Sev1,Sev1,Sev1,Sev2,Sev2,Sev2,Sev2",
                    (Environment="Test"), "Sev1,Sev1,Sev2,Sev2,Sev2,Sev3,Sev3")|makemv delim="," Severity|mvexpand Severity
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Next you have to ensure that every Severity has a value (fillnull for &lt;CODE&gt;0&lt;/CODE&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval EnvironmentPhase=Environment . ":" . Phase
| chart count BY EnvironmentPhase Severity
| untable EnvironmentPhase Severity count
| rex field=EnvironmentPhase "(?&amp;lt;Environment&amp;gt;[^:]+):(?&amp;lt;Phase&amp;gt;[^:]+)" | fields - EnvironmentPhase
| sort 0 - Phase
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lastly, we build the transposed view that you desire:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval EnvironmentSeverity=Environment . ":" . Severity
| chart first(count) BY EnvironmentSeverity Phase
| rex field=EnvironmentSeverity "(?&amp;lt;Environment&amp;gt;[^:]+):(?&amp;lt;Severity&amp;gt;[^:]+)" | fields - EnvironmentSeverity
| stats list(*) AS * BY Environment
| fields Environment Severity Phase*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This results in a view like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Environment   Severity   Phase1   Phase2   Phase3
       Prod       Sev1        4        4        4
                  Sev2        5        5        5
                  Sev3        4        4        4
       Dev        Sev1        3        3        3
                  Sev2        4        4        4
                  Sev3        0        0        0
       Test       Sev1        2        2        2
                  Sev2        3        3        3
                  Sev3        2        2        2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 May 2016 08:28:21 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2016-05-25T08:28:21Z</dc:date>
    <item>
      <title>Is there way to group columns of a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259205#M77697</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I have one requirement in which certain columns have to be grouped together on a table. &lt;BR /&gt;
I have XSL sheet data as below. During indexing, I changed below columns as Prod_Sev1 Prod_Sev2 and so on, but is there way to show the same result with the format below? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Phase           Prod                  Dev                     Test
          Sev1  Sev2  Sev3      Sev1  Sev2   Sev3      Sev1   Sev2   Sev3

Phase1    4     5     4         3     4      0         2      3      2
Phase2    4     5     4         3     4      0         2      3      2      
Phase3    4     5     4         3     4      0         2      3      2      
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:44:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259205#M77697</guid>
      <dc:creator>praveenkpatidar</dc:creator>
      <dc:date>2020-09-29T09:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is there way to group columns of a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259206#M77698</link>
      <description>&lt;P&gt;Sure...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| rename Prod_Sev1 AS "1.P_Sev1", Prod_Sev2 AS "2.P_Sev2", Prod_Sev3 AS "3.P_Sev3", Dev_Sev1 as "4.D_Sev1", Dev_Sev2 as "5.D_Sev2", Dev_Sev3 as "6.D_Sev3" ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That would put them in sequential order but not add the 1st header, and combine columns like your 1st row of data there.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 07:10:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259206#M77698</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-20T07:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there way to group columns of a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259207#M77699</link>
      <description>&lt;P&gt;No, but it can be done transposed like this:&lt;/P&gt;

&lt;P&gt;This fakes the base data (you have a base search for this):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS Environment
|eval Environment="Prod,Dev,Test"|makemv delim="," Environment|mvexpand Environment
|eval Phase="Phase1,Phase2,Phase3"|makemv delim="," Phase|mvexpand Phase
|eval Severity=case((Environment="Prod"), "Sev1,Sev1,Sev1,Sev1,Sev2,Sev2,Sev2,Sev2,Sev2,Sev3,Sev3,Sev3,Sev3",
                    (Environment="Dev"), "Sev1,Sev1,Sev1,Sev2,Sev2,Sev2,Sev2",
                    (Environment="Test"), "Sev1,Sev1,Sev2,Sev2,Sev2,Sev3,Sev3")|makemv delim="," Severity|mvexpand Severity
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Next you have to ensure that every Severity has a value (fillnull for &lt;CODE&gt;0&lt;/CODE&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval EnvironmentPhase=Environment . ":" . Phase
| chart count BY EnvironmentPhase Severity
| untable EnvironmentPhase Severity count
| rex field=EnvironmentPhase "(?&amp;lt;Environment&amp;gt;[^:]+):(?&amp;lt;Phase&amp;gt;[^:]+)" | fields - EnvironmentPhase
| sort 0 - Phase
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lastly, we build the transposed view that you desire:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval EnvironmentSeverity=Environment . ":" . Severity
| chart first(count) BY EnvironmentSeverity Phase
| rex field=EnvironmentSeverity "(?&amp;lt;Environment&amp;gt;[^:]+):(?&amp;lt;Severity&amp;gt;[^:]+)" | fields - EnvironmentSeverity
| stats list(*) AS * BY Environment
| fields Environment Severity Phase*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This results in a view like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Environment   Severity   Phase1   Phase2   Phase3
       Prod       Sev1        4        4        4
                  Sev2        5        5        5
                  Sev3        4        4        4
       Dev        Sev1        3        3        3
                  Sev2        4        4        4
                  Sev3        0        0        0
       Test       Sev1        2        2        2
                  Sev2        3        3        3
                  Sev3        2        2        2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 May 2016 08:28:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259207#M77699</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-05-25T08:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Is there way to group columns of a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259208#M77700</link>
      <description>&lt;P&gt;Hello woodcock&lt;BR /&gt;
I have posted a query. I think it's similar to this one. Could you suggest?&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/817006/how-can-i-format-a-table-as-rows-into-columns.html"&gt;https://answers.splunk.com/answers/817006/how-can-i-format-a-table-as-rows-into-columns.html&lt;/A&gt;&lt;BR /&gt;
Thank You!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 01:23:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-way-to-group-columns-of-a-table/m-p/259208#M77700</guid>
      <dc:creator>rarangarajanspl</dc:creator>
      <dc:date>2020-04-16T01:23:46Z</dc:date>
    </item>
  </channel>
</rss>

