RFM & segmentation
RFM Analysis for Thai Online Shops: A Complete Four-Quartile Guide
Learn how to score customers with four independent RFM quartiles (1 = best, 4 = worst), read composite codes like "114", handle ties and small samples, and turn scores into practical retention decisions — with a fully worked eight-customer example.
อ่านเป็นภาษาไทย
Why RFM Matters for Thai Online Shops
If your customer list is growing but your team cannot explain whom to follow up with, RFM provides a structured starting point. It groups customers by purchase recency, frequency and spending so you can inspect different histories before deciding what action is appropriate.
RFM describes three aspects of past purchases from a stated scope of order history: how recently a customer bought, how many qualifying orders they placed and how much they spent. In the four-quartile convention used here, a code of '111' means the customer is in the strongest purchasing group on all three dimensions. A code of '444' means the least recent, lower-frequency and lower-spending groups. These are descriptions of recorded purchasing, not judgments about a person's value or predictions of what they will do.
This guide covers the required data, independent quartile rankings, composite codes, limitations and first-week decisions. The eight-customer teaching table supplies fictional frequency and spending inputs. Readers can verify the date differences, quartile assignments and summed totals from that summary; the 36 underlying order records are not reproduced.
Core Definitions: Recency, Frequency, and Monetary Value
Before scoring anything, it is worth being precise about what each dimension actually measures — and what it does not.
Recency (R) is the number of days between the customer's most recent qualifying order and a fixed analysis date. Smaller values are more recent. In this guide, R=1 is the most recent group and R=4 the least recent group. A recent purchase does not by itself show satisfaction, brand engagement or readiness to buy again.
Frequency (F) is the count of distinct qualifying orders placed by the customer within the stated observation window. Higher counts mean more recorded purchases, not necessarily a habit or a particular motivation. Several product lines on one order must not become several purchases in this teaching calculation.
Monetary value (M) is total spending within the same stated scope, using a documented definition of included amounts. The example below uses merchandise amounts after discounts, excluding shipping and tax. Spending is not profit, predicted lifetime value or evidence of a customer's preferences. Margin requires cost information that this example does not contain.
Two important boundaries to set now. First, each dimension is scored independently — R does not influence the F score or the M score. Second, the composite code is a text string of three digits, not a sum. A code of '114' means R=1, F=1, M=4; it does not mean the customer scored 6 out of 12. Treating the composite as an arithmetic sum destroys the diagnostic information in each dimension.
Sources: HubSpot: RFM Analysis — A Data-Driven Approach to Customer Segmentation · Microsoft Dynamics 365 Commerce: Set Up RFM Analysis
Data Preparation: What to Collect and How to Clean It
For a prepared order-level table, collect a stable customer key, a stable order key, the order date and the monetary amount used in the analysis. An order key must remain unique across the included sources; keep its source identifier if order numbers can overlap. Raw exports also need the status, refund and adjustment information required by your inclusion policy. Keep customer and order identifiers as text.
Decide which orders qualify and document how cancellations, full refunds and partial refunds affect Frequency and Monetary value. A shared phone number, similar name or matching contact detail is a clue to investigate, not sufficient proof that two records belong to the same customer. Preserve uncertain matches separately until identity is confirmed. Set one analysis date and a stated observation window. If the export contains line items, count each qualifying order once and avoid summing an order total repeated on several rows.
Once clean, aggregate by customer: calculate days-since-last-order for Recency, count distinct order IDs for Frequency, and sum order values for Monetary. You now have one row per customer with three numeric inputs ready for scoring.
Sources: HubSpot: RFM Analysis — A Data-Driven Approach to Customer Segmentation · Shopify: RFM Analysis — Definition and Segmentation Guide
The Four-Quartile Scoring System: 1 Is Best, 4 Is Worst
CasperBrain uses four quartiles: 1 is best and 4 is worst on each purchasing dimension. Four-bin ranking divides the selected population into groups that are as equal in size as the chosen method allows. Eight customers give two per group. Other population sizes and tie-handling rules can produce unequal groups, so a score does not always represent exactly 25% of customers.
For Recency, sort the days-since-purchase values from smallest to largest. The most recent group receives R=1. For Frequency and Monetary value, sort from largest to smallest; the highest order-count group receives F=1 and the highest spending group receives M=1. These directions must be checked before interpreting any label.
The groups in this example are relative to the selected customer population. A shop selling frequently replenished household goods can have a different distribution from a shop selling occasional large purchases. The same code can therefore correspond to different raw values. Record the population, analysis date and window instead of treating a rank as an industry benchmark.
An important implementation note: each dimension is ranked and split independently. Sorting by Recency to assign R scores and then sorting by Frequency to assign F scores are two separate passes over the data. A customer's rank in one dimension has no bearing on their rank in another.
With eight customers and no ties, each quartile below contains exactly two customers. The worked calculation is an educational illustration, not a description of undocumented current report logic, order exclusions or tie-breaking behavior.
Sources: HubSpot: RFM Analysis — A Data-Driven Approach to Customer Segmentation · Microsoft Dynamics 365 Commerce: Set Up RFM Analysis
Worked Example: Eight Fictional Customers as of 2026-09-08
This fictional, already-aggregated customer summary covers qualifying orders dated 1 January through 8 September 2026, using Bangkok calendar dates. Recency is measured against 8 September 2026. Frequency counts distinct qualifying orders; Monetary sums merchandise amounts after discounts, excluding shipping and tax. Assume no cancellations or refunds in this teaching dataset. The summaries contain 36 orders and ฿42,500 across eight customers. Readers can verify the recency calculations, totals and quartile assignments from the table; the underlying 36 transaction rows are not presented.
To assign Recency scores, sort customers by days-since-last-purchase ascending (lowest = most recent = best). Customers A (2 days) and B (5 days) fall in Q1 → R=1. Customers C (10 days) and D (20 days) fall in Q2 → R=2. Customers E (35 days) and F (50 days) fall in Q3 → R=3. Customers G (80 days) and H (120 days) fall in Q4 → R=4.
To assign Frequency scores, sort customers by order count descending (highest = most frequent = best). Customer A (8 orders) and B (7 orders) → F=1. C (6) and D (5) → F=2. E (4) and F (3) → F=3. G (2) and H (1) → F=4.
To assign Monetary scores, sort customers by total spend descending (highest spend = best). H (9,000 ฿) and A (8,000 ฿) → M=1. C (7,000 ฿) and D (6,000 ฿) → M=2. E (5,000 ฿) and F (4,000 ฿) → M=3. G (3,000 ฿) and B (500 ฿) → M=4.
The final column concatenates the three labels. Customer H receives M=1 despite being the least recent and least frequent buyer in this sample. Keeping the separate values makes that difference visible. It does not establish that H will return, that the purchase was profitable or that H should receive a particular offer.
| Customer | Last Order | Days Ago (R input) | Orders (F input) | Total Spend ฿ (M input) | R Score | F Score | M Score | Composite Code |
|---|---|---|---|---|---|---|---|---|
| A (fictional) | 2026-09-06 | 2 | 8 | 8,000 | 1 | 1 | 1 | 111 |
| B (fictional) | 2026-09-03 | 5 | 7 | 500 | 1 | 1 | 4 | 114 |
| C (fictional) | 2026-08-29 | 10 | 6 | 7,000 | 2 | 2 | 2 | 222 |
| D (fictional) | 2026-08-19 | 20 | 5 | 6,000 | 2 | 2 | 2 | 222 |
| E (fictional) | 2026-08-04 | 35 | 4 | 5,000 | 3 | 3 | 3 | 333 |
| F (fictional) | 2026-07-20 | 50 | 3 | 4,000 | 3 | 3 | 3 | 333 |
| G (fictional) | 2026-06-20 | 80 | 2 | 3,000 | 4 | 4 | 4 | 444 |
| H (fictional) | 2026-05-11 | 120 | 1 | 9,000 | 4 | 4 | 1 | 441 |
Reading the Composite Code: A Decoder Guide Using Customer B ('114')
Read the three-character code in R, F, M order. Each position retains its own meaning. It is a text label such as '114', not the number 114 and not a sum of the three scores. Keep the original raw values beside the code so a colleague can explain how it was formed.
Customer B in our fictional example carries the code '114'. Decoded: R=1 means B is among the 25% of customers who bought most recently — only 5 days before the analysis date. F=1 means B is among the 25% who buy most often — 7 orders in the window. M=4 means B is among the 25% who spend the least — only 500 baht total across all orders.
Customer B made seven orders totalling ฿500, an average of approximately ฿71.43 per order in this example. The '114' code records B's relative purchasing ranks; it does not explain product preferences, voucher use, occupation or reasons for buying. Check order details and customer feedback before proposing a larger basket or different offer.
The figure below maps Customer B's three scores visually to show how each dimension sits independently within the four-level scale.
Read the three positions in R, F, M order. Each label refers to a separate ranking; 1 is best and 4 is worst within this fictional eight-customer sample. These ranks do not explain purchasing motives.
- 01R=1 · Recency
Bought 5 days ago — top 25% most recent
- 02F=1 · Frequency
7 orders — top 25% most frequent
- 03M=4 · Monetary
500 ฿ total — bottom 25% lowest spend
Why This Guide Keeps the Three Scores Separate
The independence of the three scoring passes is not a technical detail — it is the core design decision that makes composite codes informative. Each dimension is sorted and binned separately, so the rank of a customer in Recency says nothing about where they will land in Frequency or Monetary.
Customer H last bought 120 days ago, placed one qualifying order and spent ฿9,000. The code '441' retains all three facts as relative ranks. Adding 4+4+1 gives 9 and averaging gives 3.0, but that single value hides which dimension differs. A long gap may be normal for an occasional purchase. Inspect the product, earlier history, unresolved issues and contact preferences before deciding whether a follow-up would be useful.
Practically, when sorting your customer list, always maintain three separate score columns and sort or filter on each independently when building segment lists. Do not create a fourth 'total RFM score' column and sort on that as the primary criterion. If you want a ranked ordering for prioritisation, be explicit about which dimension you are prioritising and why.
Sources: Shopify: RFM Analysis — Definition and Segmentation Guide
Ties, Small Samples, and Population-Change Limitations
With only eight customers, the worked example above is pedagogically clean: no ties occur and every quartile contains exactly two customers. Real shop data is messier in three important ways.
Ties need an explicit, repeatable rule. Two customers with the same raw value can fall near a bin boundary. Some methods keep tied values together and accept uneven groups; others split ranks using a documented secondary order. Do not assume a vendor's tie method or use random reassignment in a repeatable process. If most customers have one order, inspect whether Frequency meaningfully distinguishes them before relying on the ranks.
Small groups make individual movements more visible. Dividing 15 customers as evenly as possible gives groups of 4, 4, 4 and 3. With fewer than four customers, four populated groups are impossible. Inspect the raw purchase history and explain these limitations. The sources used here do not establish a universal 40- or 50-customer minimum for using RFM.
Separate two changes. Recency days increase as the analysis date advances when no new purchase occurs. Relative scores can also change when the comparison population or observation window changes, even if some raw inputs remain the same. Compare raw values, reference date, window and population before explaining a score movement. A changed rank does not show that the market became more competitive.
Promotions or seasonal buying may change the mix of orders in a selected window. Incomplete imports can also change what the analysis sees. Check source coverage and explain which periods are missing. For a shop with occasional purchases, a short history may omit earlier orders that are relevant to the decision. These are reasons to inspect the data, not evidence that one fixed window is right for every shop.
Sources: Shopify: RFM Analysis — Definition and Segmentation Guide · HubSpot: RFM Analysis — A Data-Driven Approach to Customer Segmentation
Segment Portraits and the Practical Follow-Up Decision Framework
The table proposes questions for a few code patterns. Its labels are plain-language teaching descriptions, not verified product segment names or a predictive model. A code alone does not determine contact eligibility, customer value or an appropriate offer. Respect agreed callbacks and refusals before any discretionary outreach.
A '4' in Monetary and a '4' in Recency describe different observations. B's '114' means recent, frequent purchasing with lower total spending. H's '441' means a longer gap and fewer purchases with high total spending. Read the complete code and raw history; neither deserves a generic response merely because the same digit appears.
A longer purchasing gap can justify reviewing a customer's history, particularly when earlier purchases were frequent. Check the usual buying cycle, missing orders, unresolved issues and contact preferences before selecting outreach. The score alone does not establish that the customer has lapsed, that contacting them now costs less or that a particular channel will work. CasperBrain supports analysis and planning; CasperCall is the separate connected execution product.
| Code Pattern | Portrait Name | Description | Suggested First Action |
|---|---|---|---|
| 111 | Strong purchasing ranks | Recent, frequent and high total spending within the selected population. | Review the relationship and purchase experience; keep any existing service commitments. |
| 11x (x > 1) | Recent and frequent; lower total-spending rank | R=1 and F=1; M is 2, 3 or 4. This does not by itself describe spending per order. | Inspect actual order values and product context before proposing a useful next action. |
| 1x1 or x11 | Strong on two dimensions | The unspecified dimension must be read separately. An x11 customer is not necessarily recent. | Inspect the third raw value, normal purchase cycle and contact history. |
| 222 / 333 | Middle-ranked patterns | These codes describe ranks; they do not establish activity status or how common the groups are. | Compare raw values using the same dates and scope before explaining a change. |
| 44x (x < 3) | Longer gap, lower frequency, higher spending rank | The order history may reflect an occasional large purchase, as with H=441. | Check the buying cycle and purchase experience; do not assume a win-back campaign is needed. |
| 444 | Least recent, lower frequency and spending | The lowest purchasing quartile on each dimension is not a probability of return. | Check data completeness and the reason for any proposed contact; defer outreach without a useful reason. |
| 141 | Recent, low-frequency, high total spend | R=1, F=4, M=1. This may be a new or occasional buyer; check the first-order date and purchase history. | Review the purchase experience and normal buying cycle before selecting a follow-up. |
Sources: HubSpot: RFM Analysis — A Data-Driven Approach to Customer Segmentation · Shopify: RFM Analysis — Definition and Segmentation Guide
One-Week Action Checklist for Shop Owners
After running an RFM analysis for the first time, the temptation is to design elaborate segment workflows immediately. A more reliable approach is to move through a structured first week that validates the data, tests one or two communications, and builds the habit of reading scores before refreshing them.
Day 1 — Audit the data: Confirm source coverage, the analysis window and the qualifying-order policy. Check one prepared row per order and verified customer identity. Keep uncertain matches separate. Reconcile distinct orders, customers and included spending against a small source sample before using any ranks.
Day 2 — Check a few scores: Pick several customers with different recorded histories and reproduce their raw values. When a result is unexpected, check customer identity, included orders, dates, filters, raw values and the scoring calculation. A surprising rank can also be a legitimate result of the selected population.
Day 3 — Compare different profiles separately: Start with '111','114'and'441'. The first is in the strongest purchasing quartile on all three dimensions. The second bought recently and frequently but has lower total spending. The third made fewer purchases, with a longer gap, but has high total spending. Review each customer's history and contact preferences before choosing a next action.
Day 4 — Draft a useful next step: Choose one small group with a clear reason for contact. Write a short message that identifies the shop, asks whether it is convenient to continue and leaves room for the customer's actual answer. A recent purchase may call for an experience check; an agreed callback should follow the customer's commitment. Do not infer remaining stock or a problem from dates alone.
Day 5 — Define the measurement first: State who is included, the valid-purchase definition, the denominator and the follow-up window before starting. Record what happened after that window. A higher observed purchase rate does not by itself prove the contact caused the change. A comparable control design is needed to investigate incremental effects, and a small sample may remain inconclusive.
Day 6 — Record the scope and thresholds: Keep the analysis date, observation window, included population and actual boundary values for each dimension with the results. At the next review, compare these alongside raw customer values so a population change is not mistaken for an individual change.
Day 7 — Agree when scores must be refreshed: Check that new orders and corrections are reflected before using scores for an operational decision. Record the analysis date and choose a review cadence appropriate to how frequently the team acts. A monthly purchasing cycle does not by itself make month-old scores suitable for today's customer list.
Sources: Shopify: RFM Analysis — Definition and Segmentation Guide · HubSpot: RFM Analysis — A Data-Driven Approach to Customer Segmentation
Vendor Scoring Conventions to Avoid Importing
Different RFM implementations use different score directions, division counts and aggregation methods. Confirm those rules before carrying an interpretation from another system into CasperBrain.
The Shopify RFM guide describes a 1–5 convention with higher scores representing stronger purchasing signals. That must not replace CasperBrain's four-quartile convention, where 1 is best and 4 is worst. The examples here are deliberately labelled so readers can distinguish the methods.
Microsoft Dynamics documentation describes configurable divisions and optional aggregation. This demonstrates that separate text codes and combined scores are design choices, not interchangeable definitions. Retain CasperBrain's separate R, F and M meanings and do not present an external vendor's configuration as a CasperBrain feature.
For this guide, '114'and'222' both sum to 6, yet describe different histories. A combined score may serve a separately specified method, but it cannot replace the three-position interpretation taught here. Explain any prioritisation rule and test it against the decision it is supposed to support.
Sources: Shopify: RFM Analysis — Definition and Segmentation Guide · Microsoft Dynamics 365 Commerce: Set Up RFM Analysis
Glossary and Frequently Asked Questions
Analysis date: The fixed reference point from which all Recency values are calculated. Must be consistent across all customers in one analysis run.
Composite code: A three-character text string representing R, F, and M scores in order (e.g., '114'). It is read as three independent values, not as a number.
Quartile: One of four groups formed from a ranked distribution. The eight-customer example has equal groups of two. Other population sizes or tie policies may produce unequal groups; a label does not always represent exactly 25% of customers.
Recency in this example: Days from the most recent qualifying order to 8 September 2026, using Bangkok calendar dates. R=1 is the most recent group.
Frequency in this example: Distinct qualifying orders from 1 January through 8 September 2026. F=1 is the highest-count group. This definition does not assert undocumented product-wide counting behavior.
Monetary value in this example: Merchandise spending after discounts, excluding shipping and tax, in the stated window. No refunds or cancellations occur in the fictional dataset. M=1 is the highest-spending group.
Q: Can I compare RFM scores between two different shops? A: Not directly. Because quartile boundaries are set relative to each shop's own customer distribution, a score of R=1 at Shop A and R=1 at Shop B describe different absolute behaviours. Scores are internally relative, not universal.
Q: Should I include test orders? A: Identify and exclude records that do not represent the customer purchases you intend to analyse. Document your inclusion policy and keep it consistent; a label such as staff or fulfilment does not by itself explain whether an underlying purchase is real.
Q: My shop has 15 customers. Is RFM useful? A: Start with the raw values and the question you want to answer. Four groups as equal as possible contain 4, 4, 4 and 3 customers, so individual movements are visible. With fewer than four customers, four populated groups are impossible. There is no universal minimum established here; explain the sample's limits.
Q: Does '111' mean the customer will definitely buy again? A: No. It describes relative purchasing history within a chosen scope. It does not establish satisfaction, profitability or a future purchase. Use it to identify a history worth reviewing before selecting an action.
Five sequential steps transform raw order records into an actionable composite code. Each RFM dimension is scored independently in its own sort pass before the three scores are concatenated. Fictional eight-customer dataset used as illustration.
- 011. Clean & Aggregate
Apply the documented valid-order and cancellation/refund policy, including partial refunds. Preserve raw orders; derive a customer summary with R(days), F(distinct valid orders) and M(total qualifying spend).
- 022. Score Recency
Sort by days since the latest qualifying purchase, ascending. Assign R=1 to the first group, R=2 to the next, then R=3 and R=4 using the chosen quartile/tie method. Equal quarters apply to this clean eight-customer example, not every population.
- 033. Score Frequency
Sort descending by order count independently. Highest-ranked group → F=1 … lowest-ranked group → F=4.
- 044. Score Monetary
Sort descending by total spend independently. Highest-ranked group → M=1 … lowest-ranked group → M=4.
- 055. Concatenate Code
Combine as text: R-score + F-score + M-score = composite code (e.g., '114'). Do not sum or average.
Sources and editorial method
Examples are fictional and contain no customer records. Prepared by the CasperBrain team with AI drafting assistance; facts and language are checked before publication.