Use Case

Customer Segmentation Using RFM (Recency, Frequency, Monetary) Model

Customer segmentation is the process of dividing existing and potential customers into sub-groups (also known as segments) based on shared characteristics with the aim of identifying profitable or highest growth potential customers. 

Segmentation analysis informs existing and go-forward strategy by answering questions like:

  • Which advertising campaign will resonate best with our target market(s)?
  • Which demographics are most likely to buy our product or service?
  • How large is the market opportunity for our product or service?

While there are numerous approaches for sales and marketing analysts to perform segmentation analysis — e.g. demographic, psychographic, geographic, behavioral, firmographic, etc. — a common approach in retail is the Recency, Frequency, Monetary (RFM) model. This post will showcase how to perform RFM analysis in Tellius — the leading AI-Powered Insights & Analytics platform — as well as how to utilize Tellius’s own unique Guided Insight to automatically identify segments of high-value customers.

What is the Output of RFM Customer Segmentation Analysis?

The output of our analysis for RFM customer segmentation will have two parts:

  1. Interactive RFM Vizpad: An interactive, drill-able set of visualizations to see how customers in our analysis fall against recency, frequency, and moentary parameters.
  2. Customer Segments: High value segments of customers generated from our Guided Insights capability

Ready to dive in? Let’s go! 

P.S. — If you want to a more advanced customer segmentation approach involving machine learning clustering, Tellius can do that too.

Data for RFM Analysis

The first step to performing any analysis is to load and connect our data in a point-and-click manner. The data consists of customer and order details from a typical CRM system, as follows:


  •   Internal data containing customer orders, product description, customer details, and shipping information.


  •   Sales Orders
  •   Order Returns
  •   Sales Rep Data

Let’s dive into how a marketing analytics team can go from connecting various complex data sources to running customer segmentation analysis in order to identify groups of customers with the highest value.

Loading the Data

First, we start with loading data from multiple sources, including internal and external sources.

Once we have the data loaded, Tellius helps us evaluate the quality of the data by inferring the data types of each column and automatically creating descriptive statistics for each column to help users streamline initial exploratory data analysis.

We are going to describe two approaches to customer segmentation analysis that can be performed using Tellius: RFM analysis and augmented segmentation. First, we will perform RFM analysis for customer segmentation.


Creating Metrics for RFM Analysis

RFM stands for Recency, Frequency, and Monetary each corresponding to a key customer metric. These metrics are extremely important indicators of a customer’s lifetime value, retention, and engagement.

RFM metrics help marketing teams identify the following facts about customers:

  •   the more recent the purchase, the more responsive the customer is to promotions.
  •   the more frequently the customer buys, the more engaged and satisfied they are.
  •   monetary value differentiates heavy spenders from low-value purchasers
Preparing the Data

Before we can perform customer segmentation, we need to modify our dataset, create new columns, and aggregate it to have one row per customer ID. Our input dataset has multiple orders per customer and looks like this:

Tellius’s Data Prep layer provides full flexibility for the advanced users to incorporate the required logic in order to manipulate the data using Python or SQL. 

In the data, we have a sale amount for each order from which we can calculate the total monetary value of each customer. We also have a unique ID for each order, which we can use to calculate the number of orders and thus Frequency rank. To calculate Recency, we need to know how much time has passed since the last order for each customer. Let’s use the Tellius data prep layer to calculate the last order date as well as the number of days since the last order for each customer.

Step 1. Using Pandas, calculate the last order date across the entire dataset

Step 2. Using SQL, calculate the difference between the last order date for the dataset and the order date for each customer.

Step 3.  Now that we have features for all three metrics, i.e. total value for all orders for each customer for Monetary, number of orders for Frequency, and the number of days since the last order for Recency, we can aggregate and rank the metrics for each customer using SQL.

Step 4. Using Pandas, we can break down each metric into a set of five quantiles, thus ranking customers into five different categories by monetary value, frequency of orders, and recency since the last order.

The values of each newly created column range between 1 and 5 and serve as a ranking for each customer with respect to RFM (recency, frequency, monetary).

Step 5. Adding the quantile for each metric gives us the overall rank for the customer ranging between 1 and 15. However, to make segment values more manageable to analyze, we apply the NTILE function in SQL to group the total rank into five categories.


The resulting dataset now has a unique row per Customer ID with the series of columns (Recency, Frequency, Monetary) defining rankings for each metric and the overall rank of each customer. The higher the rank, the greater the customer value.

Exploring Customer Segments

Now the marketing analytics team can easily use Tellius Search to quickly identify segments of customers with the highest lifetime value, customers that need to be targeted with the next campaign, or customers that may need to be incentivized with a coupon or a simple promotion. Tellius’ powerful Search interface understands your question, calculates an answer in seconds, and returns the best fit visualization based on the variables used in your question.

For example, in order to identify the segment of high value customers, the marketing team can use the Search to ask “show me data for monetary and frequency and recency by segment

Tellius returns a bar graph useful for quickly identifying that Segment 5 has the customers with highest value, since it’s characterized by the highest monetary value, highest frequency of orders, and the shortest time since the last order.

Segment 2 has the customers that have the potential of migrating to Segment 5 and that is where marketing team should focus their efforts in their next marketing campaign.

SEARCH show me data for monetary and frequency and recency by segment

If the team wants to identify a list of customers in a segment, simply type: “show me segment by customer”, which returns the result in a table format with a specific customer ID value

SEARCH show me segment by customer

Another way to identify high-value customers is to ask Tellius the following question: “show me top 100 customers by monetary by segment”, which would return the following result.

SEARCH show me top 100 customers by monetary by segment

More complex graphs can be configured using Tellius VizPad module, where users can create a data story and preserve the results for sharing to other members of the team. With a few clicks, users can create a VizPad in Tellius that contains an interactive RFM chart, drillable by multiple dimensions in a point-and-click way.

Creating Customer Segments with Guided Insights

Tellius has built-in segmentation driver insights which allow for uncovering characteristics of a data cohort and providing ML-driven actionable insights with a few clicks. In the context of customer segmentation analysis, Tellius allows you to characterize a sub-group or a segment of your customer base and use that information to build and finetune a marketing or outreach campaign in order to target that specific buyer segment.

Although RFM approach to customer segmentation can in some cases provide enough information into the customer base and rank the buyers by their lifetime value, it usually cannot capture complex characteristics of each buyer segment.

Tellius segmentation driver insights can help users take the RFM approach to the next level and apply the power of machine learning to describe a customer segment of interest and provide a set of data values that describe the buyer group.

Let’s take a look at how we can characterize our high lifetime value customers by using Tellius segment drivers.

For this part of the analysis, we use the output of the RFM analysis, which included the columns for the total order value (Monetary), total number of orders (Frequency), and the number of days since the last order (Recency) along with the segment labels, which range between 1 and 5 with 5 being the highest lifetime value segment. We are also going to enrich our dataset by bringing back the information on the customers, such as country, region, and customer type, as well as the orders, such as shipping type, discount, profit, and product category.

The input data set is at the customer level and looks as follows

We are going to use the RFM segment label 5 as our target category of customers to be analyzed, since RFM segment 5 signifies the high value customers.

With our data set ready for analysis, we can jump into the Segment Driver.

Step 1. In the Insights menu we select Key Drivers

Step 2. Select the RFM Total_Rank segment 5 to be analyzed and provide a name for the insight output, “Who are my high value customers”.

Step 3. Select the list of columns to be included in the analysis. The columns that we need to exclude are Customer_ID and Total_Rank since Customer_ID does not have any analytical value in this case and Total_Rank contains RFM segments which we are using as the target column for this analysis so it should be excluded.

We are now ready to kick-off the Segment Driver Insights by clicking Create.


Tellius Segment Driver output looks as follows. The left section lists out the key drivers for our high value customer category in descending order by impact.  

In this case Tellius identified that the high value customers in our dataset are mostly described by product category, average discount, country, region, order priority, and ship mode. These categories were identified by fitting a random forest model with the high value customer category as the target.

Let’s take a look at the section of the output on the left in more detail. This section provides information on a series of segments where the percentage of the high value customers is the highest. In this case, Tellius identified five segments of different sets of characteristics.

If we zoom in on Segment 3, we can easily see all the important characteristics of our high value customers in that segment. For example, customers in this segment prefer to buy Furniture products, they reside in the West region of the US, they have historically enjoyed a discount of about 20%, and they typically choose the Standard Class shipping.

Segment 3 contains 39.9% of high value customers compared to the 19.2% found in that category in the overall data set. Put another way, customers with the characteristics described above are 2.1 times more likely to be high value customers. To maximize ROI in a future furniture product marketing campaign, I will definitely use this actionable segment information to select a subset of my customer base for targeting.

Focusing on another group, Segment 1, we see it has 42% of customers classified as high value with a different set of characteristics: customers typically reside in the Central region of the US, they enjoyed a discount between 20% and 45% and they typically do not shop for office supplies. Using these segment characteristics, we can avoid these segments in our next office supply promotional campaign.

The “Explore Segment” button brings up a graphical representation of each segment, where users can visually assess the categories of each segment.

Furthermore, Tellius provides an ability to assign the segment ID’s to the input data. This functionality makes it easy to identify segments at the customer ID level and create targeted lists of buyers for each marketing campaign. Segments are assigned by clicking on the Smart Insights button and specifying the input dataset name we originally used for analysis.

Tellius Segment Driver gives users an ability to run AI-powered analysis with a few clicks which traditional BI tools and analytics platforms lack. Tellius’s Insights framework allows for extensive time savings in analyzing data while producing clean, vetted, and easy-to-interpret output because there is no need to develop time consuming SQL or Python scripts or rely on the Data Science team to identify the key drivers that describe your high value customers.



In this article we provided an overview of how a marketing team can utilize Tellius’s augmented analytics platform to perform customer segmentation analysis utilizing two different approaches, a traditional RFM approach as well as a Bisecting K-Means clustering predictive model. We showcased: 

  • Tellius’ ETL layer for easy transformation, cleaning, and enriching data through point and click, SQL, and Python script. 
  • Ease of natural language search functionality that can be used by C-level executives, business users, and data scientists to quickly get answers from the data, gain insights and quickly assess the quality of data without needing to develop complex algorithms.
  • Vizpad which provides users with an ability to build data stories and share them both across the organization and third-party users.

Tellius is useful for a variety of other eCommerce & Retail applications or download our Guide to AI-Driven Analytics for eCommerce. Take Tellius for a free 14 day spin (no credit card necessary) today!

See Tellius in Action

Get a Demo

Learn More

  • Target 125
    Use Case

    Audience Targeting Made Easier

    Identify the best segments of customers for customized marketing campaigns and optimize audience targeting for CPG

    Read Now
  • CLTV 125
    Use Case

    Analyzing and Predicting Customer Lifetime Value (CLTV)

    Calculate, analyze, and predict customer lifetime value (CLTV) faster and easier with AI-Driven Analytics

    Read Now
  • Webinar

    Elevate Analytics Maturity to the Next Level with AI-Powered Business Intelligence

    Join Chandana Gopal, Research Director, Future of Intelligence at IDC, to explore how AI-powered business intelligence elevates everyone in the organization - business users, analysts, and data experts - to gain insights faster and accelerate business outcomes in new and impactful ways.

    Watch Now