<?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 transpose data and create a new row? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409378#M118100</link>
    <description>&lt;P&gt;Thanks! It looks good!&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jun 2018 08:10:26 GMT</pubDate>
    <dc:creator>kevingo75</dc:creator>
    <dc:date>2018-06-26T08:10:26Z</dc:date>
    <item>
      <title>How to transpose data and create a new row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409375#M118097</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have a table data looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Time              Type          Count
--------       ----------     --------------
2018/01          A                 10
2018/01          B                  5
2018/02          A                  20
2018/02          B                  10
...                      ...                ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to transpose it and create a new row by B divide by A :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Type     2018/01   2018/02    ...
A          10           20
B          5             10
C          0.5           0.5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried &lt;CODE&gt;| transpose 0 header_field=Time&lt;/CODE&gt; but it does not work.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 03:39:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409375#M118097</guid>
      <dc:creator>kevingo75</dc:creator>
      <dc:date>2018-06-26T03:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose data and create a new row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409376#M118098</link>
      <description>&lt;P&gt;@kevingo75, instead of transpose try the following chart command on existing table as per your question:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourCurrentSearchResultingInFirstTable&amp;gt;
| chart sum(Count) as count by Type Time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere search based on the sample data provided in the question (commands from &lt;CODE&gt;|makeresults&lt;/CODE&gt; till the &lt;CODE&gt;|table&lt;/CODE&gt; command generate the dummy data as per the question:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval data="2018/01,A,10;2018/01,B,5;2018/02,A,20;2018/02,B,10" 
| makemv data delim=";"
| mvexpand data
| makemv data delim=","
| eval Time=mvindex(data,0),Type=mvindex(data,1),Count=mvindex(data,2)
| table Time Type Count
| chart sum(Count) as count by Type Time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jun 2018 07:12:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409376#M118098</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-26T07:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose data and create a new row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409377#M118099</link>
      <description>&lt;P&gt;hi @kevingo75&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults |  eval  Time ="2018/01", Type="A", Count=10 |append [|  makeresults |  eval  Time ="2018/01", Type="B", Count=5] |append [|  makeresults |  eval  Time ="2018/02", Type="A", Count=20]|append [|  makeresults |  eval  Time ="2018/02", Type="B", Count=10] |fields - _time |chart values(Count) over Time by Type |eval C=B/A  |transpose header_field=Time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jun 2018 07:20:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409377#M118099</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-06-26T07:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose data and create a new row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409378#M118100</link>
      <description>&lt;P&gt;Thanks! It looks good!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 08:10:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409378#M118100</guid>
      <dc:creator>kevingo75</dc:creator>
      <dc:date>2018-06-26T08:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose data and create a new row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409379#M118101</link>
      <description>&lt;P&gt;Great answer! Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 08:10:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-transpose-data-and-create-a-new-row/m-p/409379#M118101</guid>
      <dc:creator>kevingo75</dc:creator>
      <dc:date>2018-06-26T08:10:37Z</dc:date>
    </item>
  </channel>
</rss>

