Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Customer Retention Calculation

Hi 

I have a table where  I have custmer transactions,

TRX DateTransaction YearShowEvent Name UniqueEvent NameShow YearFirst Year SaleOriginating Master IDOriginating Master Name Total Amount 

 

TX DateTX YearProjectDepartmentProject YearCustomer IDCustomer Name
9/06/20102010DB10DB2010CIE003CIE
14/02/20142014AOG14AOG2014ENG007Energy
3/05/20112011FF11FF2011MIN033Ministry of Commerce 
20/01/20152015AOG15AOG2015134565 Gmbh
20/12/20102010AOG11AOG2011IES003IES 
19/09/20112011AOG12AOG2012DEP027Department of Economic Development
4/12/20092009FF10FF2010EMB012Embas

 

same customer can have transaction with different departments and  projects. Whats the best way to calculate customer retention (by  department)

thank you

1 REPLY 1
artemus
Microsoft Employee
Microsoft Employee

Do a group by on departement and customer ID as the key fields. In the aggregation, choose Max on TX Date . This will give you a table of when a customer did their most recent transaction. You can then add a column with a calcuation determing if the transaction is recent enough to count as being retained or not e.g.

if Date.IsInCurrentMonth([TX Date]) or Date.IsInPreviousNMonths([TX Date], 3) then 1 else 0

. After that you can do another group by on just departmenet, this time summing your new column up, and another aggregate to count rows. This will give you a customers retained and total customers. Finally you can divide. the two columns to find the percentage.

 

Note this will include all customers even if they have had no transactions in a very long time. If you want to exclude these. Do a filter on the TX Date to remove all old entries (as your first step)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.