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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.