Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Heyhey,
I've seen several 'how to count repeat customers?' posts but I have a specific question regarding repeat/recurring customers that I haven't seen anywhere else yet.
Repeat Customer: Someone who ordered one year ago today and made another purchase between one year ago today and today.
Example; Today (2020/02/25) looking back one year (2019/02/25) who ordered on that date? And from this specific customerset, who ordered another time between 2019/02/26 and 2020/02/25? Any customers that fit these criteria, label them as 'repeat customers' starting 2020/02/25.
EDIT: Important here is that, if a customer previously counted as repeat customer purchases another (third) time, he/she is not counted as a repeat customer on the day of the third purchase (or fourth, or firth etc.). A customer is counted as 'turning into a repeat customer' only once (at the second purchase, if it is within a year of the first). The same should be true for 'Future Repeat Customers'.
Future Repeat Customers: A customer who just ordered for a second time and his/her very first order was within a year ago.
Example; Today (2020/02/25) which customers placed their second order? From this specific customerset, whose first order was placed between 2019/02/26 and 2020/02/25? Any customers that fit these criteria, label them as 'future repeat customers' starting 2020/02/25 (until 2021/02/25 where they become 'repeat customers').
I'm looking to create measures from these definitions. I would like to count both repeat customers and future repeat customers on a daily basis (aggregating them weekly monthly or yearly when necessary).
I've been messing around with DAX syntax but I'm still a beginner... Below is what I have so far (on repeat customers) but I believe this measure is way to strict somehow (giving me too few repeat customers). I'm suspecting the logic might be incorrect also...
Whoever can help me, much appreciated 🙂
Solved! Go to Solution.
Hey @v-diye-msft ,
I've actually figured out a solution to both the 'reapeat customers' and 'future repeat customers' issue. I can give a short description here:
1) Add the following date columns to the orders table
Column Name | DAX |
PreviousOrderDate | CALCULATE(MAX(Orders[Order Date]), FILTER(Orders, Orders[Customer_id]=EARLIER(Orders[Customer_id]) && Orders[Order Date]<EARLIER(Orders[Order Date])) |
FirstOrderDate | CALCULATE(MIN(Orders[Order Date]), FILTER(Orders, Orders[Customer_id]=EARLIER(Orders[Customer_id])) |
TimeBetweenPurchases | DATEDIFF(Orders[PreviousOrderDate], Orders[Order Date], DAY) |
NextOrderDate | CALCULATE(MAX(Orders[Order Date]), FILTER(Orders, Orders[Customer_id]=EARLIER(Orders[Customer_id]) && Orders[Order Date]>EARLIER(Orders[Order Date])) |
InitialChurnDate | IF(NOT(Orders[FirstOrderDate] = BLANK()), Orders[FirstOrderDate] + 365) |
2) Create the following measure:
Measure Name | DAX |
repeatCustomer | COUNTROWS(CALCULATETABLE(VALUES(Orders[Customer_id]), FILTER(Orders, Orders[PreviousOrderDate] = Orders[FirstOrderDate] && Orders[TimeBetweenPurchases] <= 365))) |
For summarizing repeat customers use the InitialChurnDate as date aggregator. This way, it shows which customers turn into repeat customers (i.e., having bought a second time between their first purchase and exactly 1 year after that).
For summarizing future repeat customers use the regular order date as aggregator (From the customers who ordered on that date it checks to see if it is the second order. If it is the second order, and is within a year from the first order, the customer will be counted as future repeat customer (i.e., the customer automatically becomes a repeat customer on the date exactly a year from the their first purchase).
I know these are kind of awkward definitions for repeat/returning customers, but that's what I have to work with for now...
I consider this question answered, thanks for the help. Still, if anyone finds a more elegant solution (one that doesn't require 4 extra date columns), I would love to hear!
Hi @Anonymous
you might consider creating pbix file that will contain some sample data (remove the confidential info), upload the pbix to onedrive or dropbox and share the link to the file. Please do not forget to describe the expected results based on this sample data.
Hey @v-diye-msft ,
I've actually figured out a solution to both the 'reapeat customers' and 'future repeat customers' issue. I can give a short description here:
1) Add the following date columns to the orders table
Column Name | DAX |
PreviousOrderDate | CALCULATE(MAX(Orders[Order Date]), FILTER(Orders, Orders[Customer_id]=EARLIER(Orders[Customer_id]) && Orders[Order Date]<EARLIER(Orders[Order Date])) |
FirstOrderDate | CALCULATE(MIN(Orders[Order Date]), FILTER(Orders, Orders[Customer_id]=EARLIER(Orders[Customer_id])) |
TimeBetweenPurchases | DATEDIFF(Orders[PreviousOrderDate], Orders[Order Date], DAY) |
NextOrderDate | CALCULATE(MAX(Orders[Order Date]), FILTER(Orders, Orders[Customer_id]=EARLIER(Orders[Customer_id]) && Orders[Order Date]>EARLIER(Orders[Order Date])) |
InitialChurnDate | IF(NOT(Orders[FirstOrderDate] = BLANK()), Orders[FirstOrderDate] + 365) |
2) Create the following measure:
Measure Name | DAX |
repeatCustomer | COUNTROWS(CALCULATETABLE(VALUES(Orders[Customer_id]), FILTER(Orders, Orders[PreviousOrderDate] = Orders[FirstOrderDate] && Orders[TimeBetweenPurchases] <= 365))) |
For summarizing repeat customers use the InitialChurnDate as date aggregator. This way, it shows which customers turn into repeat customers (i.e., having bought a second time between their first purchase and exactly 1 year after that).
For summarizing future repeat customers use the regular order date as aggregator (From the customers who ordered on that date it checks to see if it is the second order. If it is the second order, and is within a year from the first order, the customer will be counted as future repeat customer (i.e., the customer automatically becomes a repeat customer on the date exactly a year from the their first purchase).
I know these are kind of awkward definitions for repeat/returning customers, but that's what I have to work with for now...
I consider this question answered, thanks for the help. Still, if anyone finds a more elegant solution (one that doesn't require 4 extra date columns), I would love to hear!
Hi,
Why not count it agains a specific day in a calendar?
- Create a calender with New Table -> Table = CALENDER(Mindate,Maxdate)
- Create a calculated column in this date table
Cust_this_day =
CALCULATE(DISTINCTCOUNT(order_table[customer_id]);
FILTER(order_table;order_table[order_date] = date_table[date])
)
- You now can create a visual using the date hierarchy (year, month, q, day) to summarize your results, use MAX - not SUM.
Hey Tijn,
Thanks for your response. I believe your solution gives me a peak number of customers in a particular time period. However, I'm looking for counts of repeat/returning/recurring customers after their first purchase, counted directly 1 year after their first purchase.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
97 | |
78 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |