<?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 could I correlate values in multiple fields that contain multiple values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/675004#M231013</link>
    <description>&lt;P&gt;Yep. My version works too&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PickleRick_0-1705913465000.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29063i617272ABB22920FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PickleRick_0-1705913465000.png" alt="PickleRick_0-1705913465000.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(of course if you do stats afterwards and not include the "zipped" field, it will vanish).&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jan 2024 08:51:34 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2024-01-22T08:51:34Z</dc:date>
    <item>
      <title>How could I correlate values in multiple fields that contain multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/674966#M231004</link>
      <description>&lt;P&gt;So, I've been away from Splunk for several years now, and now re-visiting it.&amp;nbsp; I've got a scenario where I would like to track certain metrics from imported data.&amp;nbsp; I created a simple CSV with just a few entries to demonstrate the issues I'm having.&lt;/P&gt;&lt;P&gt;Below is the source data I created:&lt;/P&gt;&lt;TABLE border="1" width="99.75062344139651%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="12.718204488778055%"&gt;customer_id&lt;/TD&gt;&lt;TD width="12.8428927680798%"&gt;Time&lt;/TD&gt;&lt;TD width="16.83291770573566%"&gt;customer_fname&lt;/TD&gt;&lt;TD width="16.58354114713217%"&gt;customer_lname&lt;/TD&gt;&lt;TD width="25.561097256857856%"&gt;products&lt;/TD&gt;&lt;TD width="15.211970074812967%"&gt;product_prices&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="12.718204488778055%"&gt;111&lt;/TD&gt;&lt;TD width="12.8428927680798%"&gt;12/1/2023&lt;/TD&gt;&lt;TD width="16.83291770573566%"&gt;John&lt;/TD&gt;&lt;TD width="16.58354114713217%"&gt;Doe&lt;/TD&gt;&lt;TD width="25.561097256857856%"&gt;product_100,product_200&lt;/TD&gt;&lt;TD width="15.211970074812967%"&gt;100,200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="12.718204488778055%"&gt;222&lt;/TD&gt;&lt;TD width="12.8428927680798%"&gt;12/11/2023&lt;/TD&gt;&lt;TD width="16.83291770573566%"&gt;Suzy&lt;/TD&gt;&lt;TD width="16.58354114713217%"&gt;Que&lt;/TD&gt;&lt;TD width="25.561097256857856%"&gt;product_100&lt;/TD&gt;&lt;TD width="15.211970074812967%"&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="12.718204488778055%"&gt;333&lt;/TD&gt;&lt;TD width="12.8428927680798%"&gt;12/15/2023&lt;/TD&gt;&lt;TD width="16.83291770573566%"&gt;Jack&lt;/TD&gt;&lt;TD width="16.58354114713217%"&gt;Jones&lt;/TD&gt;&lt;TD width="25.561097256857856%"&gt;product_300&lt;/TD&gt;&lt;TD width="15.211970074812967%"&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="12.718204488778055%"&gt;111&lt;/TD&gt;&lt;TD width="12.8428927680798%"&gt;12/18/2023&lt;/TD&gt;&lt;TD width="16.83291770573566%"&gt;John&lt;/TD&gt;&lt;TD width="16.58354114713217%"&gt;Doe&lt;/TD&gt;&lt;TD width="25.561097256857856%"&gt;product_400&lt;/TD&gt;&lt;TD width="15.211970074812967%"&gt;400&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this scenario this is just examples of customers and the items they purchased and the price paid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After uploading the file and displaying the data in a table it looks as expected:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;source="test_sales.csv"
| table customer_id,customer_fname,customer_lname,products,product_prices&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Basic_Table_Search.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29055iEB5C9D9A17B2E9A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Basic_Table_Search.png" alt="Basic_Table_Search.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Upon using makemv to convert "products" and "product_prices" to multi-value fields, again the results are as expected and the product and price align since they were input into the source CSV in the proper order:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;source="test_sales.csv"
| makemv delim="," products
| makemv delim="," product_prices
| table customer_id,customer_fname,customer_lname,products,product_prices&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="makemv_table.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29056i9812FCF6EB6EA884/image-size/large?v=v2&amp;amp;px=999" role="button" title="makemv_table.png" alt="makemv_table.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is where my issue is,&amp;nbsp; Is there a way to tie the product for a purchase transaction&amp;nbsp; in the multi-value "products" column to it's corresponding price in the multi-value "product_prices" column?&lt;/P&gt;&lt;P&gt;Everything seems to work except when I try to so something like listing the products by price for the multi-value fields like this:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;source="test_sales.csv"
| makemv delim="," products
| makemv delim="," product_prices
| stats count(products) by products,product_prices&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="product_by_price.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29059iA39EEAF5C70E2D30/image-size/large?v=v2&amp;amp;px=999" role="button" title="product_by_price.png" alt="product_by_price.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the above results you can see that I'm getting results that are not exactly what I would want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex.&amp;nbsp; it shows:&lt;/P&gt;&lt;P&gt;3 instances of product_100 at a price of 100, should only be 2 instances&lt;/P&gt;&lt;P&gt;2 instances of product_100 at a price of 200, should be 0 instances of this combination&lt;/P&gt;&lt;P&gt;2 instances of product_200 at a price of 100, should be 0 instances of this combination&lt;/P&gt;&lt;P&gt;2 instances of product_200 at a price of 200, should only be 1 instance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm likely approaching this incorrectly or using the wrong tool for the task,&amp;nbsp; any help to get me on the right track would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2024 17:55:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/674966#M231004</guid>
      <dc:creator>digital_alchemy</dc:creator>
      <dc:date>2024-01-21T17:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How could I correlate values in multiple fields that contain multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/674970#M231005</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval row=mvrange(0,mvcount(products))
| mvexpand row
| eval products=mvindex(products, row)
| eval product_prices=mvindex(product_prices, row)
| stats count(products) by products,product_prices&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 21 Jan 2024 19:35:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/674970#M231005</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-01-21T19:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: How could I correlate values in multiple fields that contain multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/674971#M231006</link>
      <description>&lt;P&gt;Multivalued fields are separate entities which means Splunk doesn't keep any "connection" between values in those fields. For Splunk each field is just a single "multivalued value" (yes, I know it sounds bad ;-)).&lt;/P&gt;&lt;P&gt;So you have to manually combine those values. One solution &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; already showed but for me it's a bit "brute force". My idea of a more "splunky" approach to splitting those products and product_prices would be to do&lt;/P&gt;&lt;PRE&gt;| eval zipped=mvzip(products,product_prices,":")&lt;BR /&gt;| mvexpand zipped&lt;BR /&gt;| eval zipped=split(zipped,":")&lt;BR /&gt;| eval products=mvindex(zipped,0), product_prices=mvindex(zipped,1)&lt;/PRE&gt;&lt;P&gt;Then you can do your stats&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2024 19:51:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/674971#M231006</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-01-21T19:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: How could I correlate values in multiple fields that contain multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/674983#M231008</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; &amp;nbsp;Thanks for the responses,&amp;nbsp; I tried both and they both give me the same result, but still not exactly what I had in mind in my head.&lt;/P&gt;&lt;P&gt;Here's the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="unsep.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29061i495452AD94774CE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="unsep.png" alt="unsep.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to do is more along the lines of being able to get a count of products that sold at specific price points from transactions that may have multiple items purchased.&lt;/P&gt;&lt;P&gt;Maybe what I'm trying to do isn't really possible or the best approach to the problem,&amp;nbsp; but the following table shows kinda what I'm trying to accomplish.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;products&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;product_prices&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;count(products)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;product_100&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;100&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;product_200&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;200&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;product_300&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;300&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;product_400&lt;/TD&gt;&lt;TD height="25px"&gt;400&lt;/TD&gt;&lt;TD height="25px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 21 Jan 2024 23:51:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/674983#M231008</guid>
      <dc:creator>digital_alchemy</dc:creator>
      <dc:date>2024-01-21T23:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: How could I correlate values in multiple fields that contain multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/675001#M231012</link>
      <description>&lt;P&gt;Here is the result when I did it&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ITWhisperer_0-1705912775121.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29062i397DC95CFA7FF4F8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ITWhisperer_0-1705912775121.png" alt="ITWhisperer_0-1705912775121.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please share your search for when you didn't get the result you were expecting&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 08:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/675001#M231012</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-01-22T08:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: How could I correlate values in multiple fields that contain multiple values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/675004#M231013</link>
      <description>&lt;P&gt;Yep. My version works too&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PickleRick_0-1705913465000.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29063i617272ABB22920FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PickleRick_0-1705913465000.png" alt="PickleRick_0-1705913465000.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(of course if you do stats afterwards and not include the "zipped" field, it will vanish).&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 08:51:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-could-I-correlate-values-in-multiple-fields-that-contain/m-p/675004#M231013</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-01-22T08:51:34Z</dc:date>
    </item>
  </channel>
</rss>

