Introduction
Hi, I am Akira, the editor-in-chief of Data Without Code. In our previous tutorial, we successfully built an automated sales data dashboard in KNIME to track revenue across different regions. That is a fantastic start for reporting.
But as a DX manager, I always tell my team: Tracking sales tells you what happened, but analyzing customer behavior tells you what to do next.
If you want to run effective marketing campaigns, you need to know who your best customers are, who is at risk of churning, and who is just a one-time buyer. To do this, professionals use a technique called RFM Analysis.
Doing this in Excel requires complex nested IF formulas and pivot tables that break easily. In this tutorial, I will show you how to perform RFM analysis and customer segmentation in KNIME—completely automatically and without a single line of code.
What is RFM Analysis?
RFM stands for Recency, Frequency, and Monetary value. It is a proven marketing model used to segment your customer base based on their purchasing habits:
- Recency (R): How recently did the customer make a purchase? (A customer who bought yesterday is more likely to buy again than someone who bought two years ago).
- Frequency (F): How often do they purchase? (Frequent buyers are more loyal).
- Monetary (M): How much money do they spend? (High spenders drive your revenue).
By scoring each customer on these three metrics (usually from 1 to 5), you can easily identify your “VIPs” (Score: 555) and your “Lost Customers” (Score: 111).
Step-by-Step: Building an RFM Model in KNIME
To build this model, you only need a standard transaction dataset containing three columns: Customer ID, Order Date, and Order Value.
Step 1: Calculate R, F, and M using the GroupBy Node
The first step is to transform your list of thousands of transactions into a unique list of customers with their specific R, F, and M values.
- Drag the GroupBy node onto your canvas and connect your transaction data to it.
- Double-click to configure it. In the “Groups” tab, select Customer ID. This ensures we get one row per customer.
- Go to the “Manual Aggregation” tab. We need to calculate three things:
- For Monetary: Select Order Value and choose the aggregation method Sum.
- For Frequency: Select Order ID (or Transaction ID) and choose the aggregation method Count.
- For Recency: Select Order Date and choose the aggregation method Maximum (This finds their most recent purchase date).
Execute the node. You now have a clean table showing exactly how much each customer spent, how many times they bought, and the date of their last purchase.
Step 2: Calculate the Days Since Last Purchase
Right now, your Recency column is just a date. We need to convert that into “Days since last purchase.”
Search for the Date&Time Difference node. Connect it to your GroupBy output. Configure it to calculate the difference between the current date (Execution Time) and the customer’s last order date, setting the output granularity to “Days”.
Step 3: Assign Scores using the Auto-Binner Node
Now we need to assign a score from 1 to 5 for each metric. You could write manual rules, but KNIME has a brilliant node called the Auto-Binner that does this automatically.
- Add the Auto-Binner node and configure it.
- Select your Recency (Days), Frequency (Count), and Monetary (Sum) columns.
- Set the number of bins to 5. KNIME will automatically divide your customers into 5 equal groups (quintiles) based on their values.
- Important: For Frequency and Monetary, a higher number is better (Bin 5). For Recency (Days), a lower number is better, so make sure to reverse the binning logic for Recency!
Execute the workflow. Boom! Every customer now has an R, F, and M score attached to their profile.
Conclusion: Your Next Steps
Congratulations! You have just completed a professional-level customer segmentation analysis without writing any code. By applying this workflow, your marketing team can now instantly pull a list of VIP customers to send exclusive offers to, or identify fading customers for a re-engagement email campaign.
This is the true power of business automation. We have covered a lot in our first 10 tutorials—from installation and data cleaning to automated dashboards and predictive segmentation.
If you want to take a step back and truly master the visual logic behind the canvas before we dive into more complex nodes, I highly recommend reading my comprehensive guide on understanding KNIME nodes and workflows visually. See you in the next phase of our no-code journey!
