Customer Segmentation via RFM Analysis

Leveraging Recency, Frequency, and Monetary (RFM) value analyses to segment customers, enabling the delivery of targeted marketing communications for each distinct group.

An organization is restructuring its loyalty program and needs to segment its customers into specific tiers for more personalized and targeted communication. Choosing the top tier based solely on their spending may inadvertently include one-time, big spenders who are no longer active customers. Likewise, segmenting based on the total number of transactions might involve customers who frequently make minor purchases, thus contributing less to the overall revenue. So, the question is: how can we comprehensively consider all these factors to effectively segment our customers for an efficient and successful marketing campaign?


RFM (Recency, Frequency, and Monetary value) analysis serves as an effective tool to segment customers based on their purchasing behavior. The factors of this analysis include:

1. Recency: The number of days since the customer's last purchase
2. Frequency: The number of times a customer has made a purchase
3. Monetary value: The total amount spent by the customer

Typically, each factor is assigned a score from 1 to 4; the higher the score, the better. For instance, a customer with a frequency score of 4 makes purchases very frequently, while a customer with a score of 1 has made only a single purchase. This scoring system allows us to create 64 unique customer segments (4x4x4).

Determining the thresholds for each segment can vary with each project, and a common approach is to examine the distribution of the Recency, Frequency, and Monetary value in our dataset and establish rules that align with business needs.

Once the RFM values are calculated, we can begin analyzing our customer segments. A customer with a 4-4-4 score is a high-value customer due to their recent, frequent, and high spending. However, we can also identify potentially valuable customers who may have lapsed. For example, a customer with a 1-4-4 score has spent a significant amount and has made frequent purchases in the past, but has not made a recent purchase. Such a segment is valuable and could be targeted with specific marketing communications to re-engage them.


The Method: First, we need to collate transactional data by client, which can be done either using SQL or in Python via pandas. For each client, we calculate the Recency (R), Frequency (F), and Monetary value (M). These RFM values are then used to create segments or clusters of clients, typically rated on a 1-4 scale for each RFM parameter. We end up with 64 unique client segments, from 1-1-1 to 4-4-4.

To visualize these clusters, we can use Plotly to create illustrative charts or treemaps showing the client distribution across RFM clusters. This process facilitates informed decision-making for targeted marketing and customer engagement strategies.

Other projects

Get in touch

If you'd like to learn more about my projects or work together, feel free to reach out! You can also connect with me on LinkedIn

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.