Skip to main content

RFM — Events Table Requirements

The RFM (Recency, Frequency, Monetary) model segments users by historical purchase behaviour:

  • Recency — time since the last purchase.
  • Frequency — number of purchases in a defined period.
  • Monetary — total spend in that period.

It helps identify loyal, at-risk, and high-value customers for tailored marketing.


Data structure overview

RFM analysis requires:

  • A transaction event table — one row per purchase.
  • At least one user identifier.
  • A monetary value per transaction.

Field names are examples, not mandatory. Identity resolution ensures cross-table consistency. Event tables follow the standard: 1 row = 1 transaction, with one timestamp and one user ID.


1. Transaction event table (required)

Column nameTypeDescription
event_timestampDATETIMEWhen the transaction occurred (UTC, mandatory)
user_idSTRINGA user identifier (mandatory)
monetaryFLOATValue of the transaction (mandatory)
transaction_idSTRINGNot required for modelling, but strongly recommended for traceability and value reconciliation

All timestamps must be in UTC.


Column nameTypeDescription
countrySTRINGCountry where the transaction was made
client_typeSTRINGe.g. B2B, reseller, end-customer — useful for filtering segments
transaction_stateSTRINGe.g. completed, refunded — needed only if the table mixes statuses

These fields allow finer segmentation by customer type, geography, or transaction status.


Best practices

Choose the right time window

  • Fast purchase cycle (fashion, food) → 3–6 month window.
  • Slow purchase cycle (electronics, luxury) → 12–24 month window.
  • Unknown cycle → default to 12 months.

Consider seasonality

If your business is seasonal (Christmas peaks, summer sales), choose a window that captures at least one full seasonal cycle.

Segment by customer type

If you serve different profiles (private individuals and resellers), use client_type to build separate RFM models — don't mix behaviours that differ drastically in frequency or value.


Summary

AreaMust-have
Event tableOne row per transaction, with user ID and timestamp
Monetary fieldRequired for monetary scoring
transaction_idRecommended for traceability
Optional enrichmentscountry, client_type, transaction_state
Recommended time window6–24 months depending on purchase cycle and seasonality
Multi-customer handlingUse client_type to separate B2B vs B2C or reseller behaviour