22/03/2025
In this blog post we'll dive into the world of RFM analysis and how you can implement it Power BI effectively. I will guide you through the steps to build an RFM model in Power BI, complete with tips, visualizations, and insights that you can use to make data driven decisions for your business by elevating customer experience. So let's get started.
What is RFM Analysis?
The recency, frequency and monetary value analysis or else RFM analysis is a marketing tool also a effective customer segmentation technique that helps businesses to identify their customer's behaviour. The theree key behavioral metrics are ;
Recency (R)
-Measure how recently customer made a purchase. Eg: when was the last purchase made?
Frequency (F)
-Measures how often a customer makes purchases within a given time frame. Eg:How many purchases has this customer made in the last year?
Monetary Value (M)
-Measures how much money a customer has spent over a specific period. Eg: What is the total revenue generated by this customer?
How does RFM work?
In this section I am going to explain the main concepts in Recency. Frequency and Monetary value Analysis.
1. Scoring - Customers are assigned to scores from 1 to 5. (Higher score better performance)
2. Segmentation - Based on the scores assigned the customers are grouped into different segments. Eg: Hibernating customers, At risk customers.
Based on the above concepts we can communicate actionable insights to the stakeholders about their customer's behaviour. Let's develop RFM Analysis in Power BI now!
Implement RFM Dashboard in Power BI
First, open Power BI Desktop and import the dataset you’ll be working with. In this case, a sample dataset has been used that includes key fields such as Customer_ID, Transaction_Date, Transaction_ID, Unit_Price, Quantity, and Transaction_Amount. These fields provide the foundational data needed to analyze customer behavior, sales trends, and overall transaction performance.
Then we need to create some measures. Create measures as per below screenshots.
Great, that completes the first section. I trust the purpose and meaning of the calculations mentioned above are clear, as they form the basis for analyzing key business metrics and gaining actionable insights from the data.
Next, we’ll move on to creating the RFM (Recency, Frequency, Monetary) table, which will be a calculated table in Power BI. This table helps in segmenting customers based on their purchasing behavior.
To begin, click on "New Table" in the Power BI ribbon, and then paste the following DAX code into the formula bar to generate the RFM table.
Now, navigate to the Modeling pane and establish a relationship between the main sales table and the RFM table using the Customer_ID columns. Power BI will automatically detect and create a many-to-one (m:1) relationship from the sales table to the RFM table, reflecting that multiple transactions can be linked to a single customer.
Now, we’ll enhance the RFM table by adding four additional columns to calculate the RFM scores. These scores are assigned based on specific percentile ranges for each RFM metric, helping us classify customer value more effectively. To do this, create new calculated columns in the RFM table using the DAX expressions shown in the images below.
Next, create the final calculated column in the RFM table. This column will concatenate the R, F, and M scores into a single string, forming the complete RFM score for each customer. This is used to connect RFM table with segments table. Refer the below image to implement.
We're almost finished. The next step is to import the RFM segments dataset into the model. You can easily find RFM segmentation datasets online, or if you’d like to use the one I’m working with, you can access it from here.
Finally, after importing the segments dataset, create a relationship between the RFM Score column in the RFM table and the Score column in the Segments table. This will result in a many-to-many (M:M) relationship, allowing you to map each customer to a corresponding segment based on their RFM score.
Now we are done with the modelling.
Now it's time to create visualizations based on the data. Feel free to design them according to your preferences, and if you need any guidance on what to visualize or how to build specific charts, don’t hesitate to ask ChatGPT for help.
Here's a screenshot of my dashboard. If you'd like access to the file, feel free to drop me a message.
I also came across a highly insightful RFM dashboard created by a Microsoft MVP—it's definitely worth checking out for inspiration. You can view it by visiting the link here.
Now we've come to the end of the post. Through this step-by-step guide, we explored how to build an RFM model in Power BI—from importing and preparing the dataset, to creating calculated columns, establishing relationships, and visualizing customer segments. RFM analysis is a powerful technique for understanding customer behavior and driving data-informed marketing strategies. Feel free to experiment with your own datasets and visual styles, and don't hesitate to reach out if you have any questions or would like to explore this topic further. Happy learning !