Which one customer do you mean?
Published: 2022-06-15 23:47:06

The company has various type's customers that depend on their behavior. It is tricky tho. I mean, if we have to create one campaign and need to choose the proper customer because of the budget. We must decide the similarity between the customers or a customer segmentation properly. So it can operate well.

I am interested, too, in how the customers can be segmented. So let's explore it using [this data set](https://archive.ics.uci.edu/ml/datasets/online+retail). But first of all, what does customer segmentation mean? Is it like breaking the customer part so we can organize it like a puzzle?

Well, the part of the puzzle, you're almost right. But we don't mean to break the human body's features into groups :(. We are only grouping customers into several clusters with one or two similarities in their behavior to fit our campaign goals.

## RFM Analysis to boost the accuracy
Thanks to Jan Roelf Bult and Tom Wansbeek in 1995, they developed Recency, Frequency, and Monetary Value (RFM analysis) so the company will select optimally which one customer base on the campaign characteristic. Here is the definition of each value :

1. Recency value measures how recently a customer has transacted with the company
2. Frequency value quantifies how frequently a customer has engaged with a brand
3. Monetary value calculates how much money a customer has spent on a company's products and services.

Theoretically, the customers will have to be segmented like below:

- Low Value: Customers who are less active than others, not very frequent buyers/visitors, and generate very low - zero - maybe negative revenue. In this case, it is cluster number 1.
- Mid Value: In the middle of everything. Customers often use our platform (but not as much as our High Values) fairly frequently and generate average revenue. In this case are the cluster numbers 2, 3, and 4.
- High Value: The group we don't want to lose. High Revenue, Frequency, and low Inactivity. In this case, it is cluster number 5.

Ok, then we are ready to deep dive into the dataset and start segmenting our customers. First of all, we have to quantify our three calculated fields, which are the RFM metrics. We need to consider that all the metrics depend on each user. So the Level Of Detail (LOD) in our calculated field must be set to Fixed so that each customer ID can group metrics without being inserted explicitly into the canvas.

## Creating RFM Calculated Field
A company can obtain the Recency value by subtracting the date of the most recent transaction from a customer with the date on the customer's first transaction. So the calculation of the Recency column is as follows.
![Recency Value](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lkicrjbhuwfhtjo2xzug.png)

Then it's time to measure the frequency of each customer at this company by calculating the unique customer id and invoice number of the transactions made so that the column will be created like this.
![Frequency Value](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4cck4wr0upqooa69jsb.png)

And the last is the number of money customers spends on all transactions in this company or the term monetary. This column is formed by multiplying the number of goods purchased by the unit price, in this case, shown in the Revenue column.
![Monetary Value](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f6chlc3j7zideaex5rtp.png)

## Percentile on Duty
Now is the time to call percentiles to segment each RFM value in each customer. Recall that percentiles divide the data you have into hundredths of parts so that the customer can do clustering easily. Make sure to look at the resulting data type in the form of a dimension with the value range of all customers being cluster 1 - cluster 5. The resulting calculations on RFM, primarily Monetary, are as follows.
![Clustering Monetary Dimension](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9ob2l7seliov2vvsr79.png) 
Do the same for the recency and frequency values. So it's time to visualize.

## Appealing Visualization
Graphics are all our friends. So let's create a segmentation based on customer behavior with a bar chart and count how many are in each cluster. Remember, before We can form a bar chart, there is a mapping of values between the three measures plus a unique total id between the three clusters. So on one page, the five clusters formed can be seen in the image below. 
![Clustering Customer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w08e2ys2scwe42pyn54r.png)

## Access All in One Dashboard
Clustering will be very useful if we know other characteristics in a cluster. Therefore you can access [this link](https://public.tableau.com/app/profile/daud.fernando/viz/ProgresRFM/RFMAnalysis) to adjust which set will be selected for a particular campaign. Ciao!