<?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 do I divide data in a column based on their values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432832#M123665</link>
    <description>&lt;P&gt;Thanks it worked perfectly.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2019 04:05:53 GMT</pubDate>
    <dc:creator>nikita012</dc:creator>
    <dc:date>2019-06-19T04:05:53Z</dc:date>
    <item>
      <title>How do I divide data in a column based on their values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432829#M123662</link>
      <description>&lt;P&gt;I have two fields in my data. Below is an example.The actual data contains 100 rows.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Store Minutes
81145 33
81234 42
87654 120
87699 400
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want the data in the below manner. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|||| shows separation of columns. 

40&amp;gt;Minutes&amp;gt;30 ||||||||500&amp;gt;Minutes&amp;gt;100
81145,81234||||||||||||87654,87699
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you please provide the code for the same?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 10:42:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432829#M123662</guid>
      <dc:creator>nikita012</dc:creator>
      <dc:date>2019-06-18T10:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I divide data in a column based on their values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432830#M123663</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | eval level=case(minutes&amp;lt;50 AND minutes&amp;gt;30, "50&amp;gt;Minutes&amp;gt;30", minutes&amp;lt;500 AND minutes&amp;gt;100, "500&amp;gt;Minutes&amp;gt;100" ) | chart values(store) as store over level by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jun 2019 11:35:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432830#M123663</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2019-06-18T11:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I divide data in a column based on their values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432831#M123664</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Someone will probably come up with a rangemap based solution. I played around with something else here, you could try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt; | streamstats values(eval(if(Minutes&amp;gt;100 AND Minutes&amp;lt;500, Store, null()))) as a, values(eval(if(Minutes&amp;gt;30 AND Minutes&amp;lt;40, Store, null()))) as b | tail 1 | eval a=mvjoin(a,","), b=mvjoin(b,",") | table a b | rename a as "40&amp;gt;Minutes&amp;gt;30", b as "500&amp;gt;Minutes&amp;gt;100"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Adjust the parameters to your need and add as many more columns as needed.&lt;/P&gt;

&lt;P&gt;To test this out, I used your example data (changing 42 to 32 so it actually falls into the first category) in a run-everywhere snippet:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval input="81135,33%81234,32%87654,120%87699,400" | makemv delim="%" input | mvexpand input | rex field=input "(?&amp;lt;Store&amp;gt;\d+),(?&amp;lt;Minutes&amp;gt;\d+)" | streamstats values(eval(if(Minutes&amp;gt;100 AND Minutes&amp;lt;500, Store, null()))) as a, values(eval(if(Minutes&amp;gt;30 AND Minutes&amp;lt;40, Store, null()))) as b | tail 1 | eval a=mvjoin(a,","), b=mvjoin(b,",") | table a b | rename a as "40&amp;gt;Minutes&amp;gt;30", b as "500&amp;gt;Minutes&amp;gt;100"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hth, but wait for someone else to jump in. I am sure there is a more elegant solution. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 11:39:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432831#M123664</guid>
      <dc:creator>knielsen</dc:creator>
      <dc:date>2019-06-18T11:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I divide data in a column based on their values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432832#M123665</link>
      <description>&lt;P&gt;Thanks it worked perfectly.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 04:05:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-divide-data-in-a-column-based-on-their-values/m-p/432832#M123665</guid>
      <dc:creator>nikita012</dc:creator>
      <dc:date>2019-06-19T04:05:53Z</dc:date>
    </item>
  </channel>
</rss>

