Splunk Search

How to create a market basket analysis?

tylampella
New Member

HI guys,

Been trying to create a market basket analysis using splunk. Simply, I would like to build a pivot that would show me what other items were bought when Product A was purchased.

I have a CSV with two columns, Transaction IDs and Products names. If a transaction had more than 1 item purchased the id will be listed with as many unique items as possible.

Example

ID-32 Product A
ID 32 Product B
ID 33 Product G
ID 33 Product B
ID 34 Product A
ID 34 Product J

etc.

I am sure Splunk can do it. I just can't wrap my brain around it right now.

Thank you.

Tags (2)
0 Karma

tachifelix
Path Finder

this search string doing the work for the following data
sample data:
partner cost
World T Plus 19000
Prix Mono 47500
Prix Mono 19000
Prix Mono 19000
World T Plus 19000
Prix Mono 19000
Prix Mono 38000
Prix Mono 19000

search string:
source="C:\tachiFlashDisc\test_firstAnswers.csv" |sort partner|table partner cost | dedup cost
result:
partner cost
Africa Telecom 9500
Africa Telecom 19000
Africa Telecom 47500
Africa Telecom 28500
B and C 0
B and C 4750
B and C 33250
B and C 14250

0 Karma

lguinn2
Legend

You could do something like this

| search_or_inputlookup_to_get_csv
| stats values(Products) as ProductList by TransactionID
| where isnotnull(mvfind(ProductList,"Product A"))
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...