<?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 Changing rows to columns and maintaining association in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551840#M156599</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;I have a table of items and I need to convert the results in the rows "pa_name" and "pa_valor" to columns and keep the relacion of each one.&lt;/P&gt;&lt;P&gt;An example, I have this:&lt;/P&gt;&lt;P&gt;index="items" id IN (3438776 3131202 3438780)&lt;BR /&gt;| stats latest(pa_nome) AS pa_nome&lt;BR /&gt;latest(ipa_valor) AS ipa_valor&lt;BR /&gt;BY id&lt;BR /&gt;| makemv delim=";" pa_nome&lt;BR /&gt;| makemv delim=";" ipa_valor&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_Mauro_Costa__1-1621247350392.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14179i800C522720D36E8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="_Mauro_Costa__1-1621247350392.png" alt="_Mauro_Costa__1-1621247350392.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_Mauro_Costa__2-1621247622863.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14180i9A75E645F5024394/image-size/medium?v=v2&amp;amp;px=400" role="button" title="_Mauro_Costa__2-1621247622863.png" alt="_Mauro_Costa__2-1621247622863.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;</description>
    <pubDate>Mon, 17 May 2021 10:39:16 GMT</pubDate>
    <dc:creator>_Mauro_Costa_</dc:creator>
    <dc:date>2021-05-17T10:39:16Z</dc:date>
    <item>
      <title>Changing rows to columns and maintaining association</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551840#M156599</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I have a table of items and I need to convert the results in the rows "pa_name" and "pa_valor" to columns and keep the relacion of each one.&lt;/P&gt;&lt;P&gt;An example, I have this:&lt;/P&gt;&lt;P&gt;index="items" id IN (3438776 3131202 3438780)&lt;BR /&gt;| stats latest(pa_nome) AS pa_nome&lt;BR /&gt;latest(ipa_valor) AS ipa_valor&lt;BR /&gt;BY id&lt;BR /&gt;| makemv delim=";" pa_nome&lt;BR /&gt;| makemv delim=";" ipa_valor&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_Mauro_Costa__1-1621247350392.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14179i800C522720D36E8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="_Mauro_Costa__1-1621247350392.png" alt="_Mauro_Costa__1-1621247350392.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_Mauro_Costa__2-1621247622863.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14180i9A75E645F5024394/image-size/medium?v=v2&amp;amp;px=400" role="button" title="_Mauro_Costa__2-1621247622863.png" alt="_Mauro_Costa__2-1621247622863.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can someone help me?&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 10:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551840#M156599</guid>
      <dc:creator>_Mauro_Costa_</dc:creator>
      <dc:date>2021-05-17T10:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Changing rows to columns and maintaining association</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551848#M156600</link>
      <description>&lt;P&gt;Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|eval {pa_nome}=ipa_valor&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 May 2021 10:57:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551848#M156600</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2021-05-17T10:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Changing rows to columns and maintaining association</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551851#M156601</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="id,pa_nome,ipa_valor
3131202,MAC Address,D0765812D877
3438776,ID de Projeto;Serial Number,PCW.609.20;CNJDJSS4X4
3438780,Serial Number;ID de Projeto,CNJDJSS9GS;PCW.609.20"
| multikv forceheader=1
| fields - _* linecount 


| makemv delim=";" pa_nome
| makemv delim=";" ipa_valor
| streamstats count as row
| mvexpand pa_nome
| streamstats count as index by row
| eval ipa_valor=mvindex(ipa_valor,index-1)
| eval {pa_nome}=ipa_valor
| fields - index ipa_valor pa_nome
| stats values(*) as * by row
| fields - row
| table id *&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 May 2021 11:00:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551851#M156601</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-17T11:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Changing rows to columns and maintaining association</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551862#M156603</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/234479"&gt;@_Mauro_Costa_&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You ca try this also.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| eval t=mvzip(ipa_valor,pa_nome) |mvexpand t | eval ipa_valor=mvindex(split(t,","),0),pa_nome=mvindex(split(t,","),1) | chart values(ipa_valor) over id by pa_nome&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval d= "id=3131202 ,pa_nome=\"MAC Address\",ipa_valor=\"D0765\"|id=3131266 ,pa_nome=\"ID De Projecto,Serial Number\",ipa_valor=\"PCW,CNJ\"|id=3131780 ,pa_nome=\"Serial Number,ID De Projecto\",ipa_valor=\"CNJ,PCW\"
    " | eval d=split(d,"|") 
| mvexpand d | eval _raw=d | kv | fields - d, _raw
| eval ipa_valor=split(ipa_valor,","),pa_nome=split(pa_nome,",")
| rename comment as "Upto Now is sample data only" 
| eval t=mvzip(ipa_valor,pa_nome) |mvexpand t | eval ipa_valor=mvindex(split(t,","),0),pa_nome=mvindex(split(t,","),1) | chart values(ipa_valor) over id by pa_nome&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一&lt;BR /&gt;&lt;BR /&gt;If this reply helps you, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 12:08:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Changing-rows-to-columns-and-maintaining-association/m-p/551862#M156603</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-05-17T12:08:11Z</dc:date>
    </item>
  </channel>
</rss>

