Retention and share
Time windows and customer membership
A cumulative total includes events from a defined start through the anchor. A cumulative distinct count counts each entity once across that window. Retention instead compares membership of a defined cohort with membership in a later period. Use the isolated model in labs/business-kpis/README.md. All amounts are fictional USD, with costs stored as positive expenses. Three complete sales months (January–March 2025), monthly Periods, two Products, single-direction active relationships to both facts, no RLS. Examples are independent measure definitions unless labeled otherwise. Native DAX is not executed. Here a purchasing customer has at least one line with Units > 0. Customer IDs are synthetic, nonblank and stable. The zero-quantity record is not a purchase. January cohort means January purchasers, not necessarily first-ever customers; no pre-January history is asserted.
Example 1 — Running totals and share
Purchasing Customers =CALCULATE(DISTINCTCOUNT(Sales[CustomerID]), KEEPFILTERS(Sales[Units] > 0))Running Revenue =VAR Anchor = MAX(Periods[MonthStart])RETURN CALCULATE([Revenue], FILTER(ALL(Periods), Periods[MonthStart] <= Anchor))Cumulative Customers =VAR Anchor = MAX(Periods[MonthStart])RETURN CALCULATE([Purchasing Customers], FILTER(ALL(Periods), Periods[MonthStart] <= Anchor))Revenue Share = DIVIDE([Revenue], CALCULATE([Revenue], REMOVEFILTERS(Products)))January, February, March running revenue is 200, 400, 600. Monthly purchasing counts are 2, 2, 1; cumulative counts are 2, 3, 4, not 2, 4, 5. Running measures intentionally reset only at the beginning of fixture history, not the earliest selected month. Product A share across all months is 75%, B 25%; February A share is 75%. The denominator ignores product filters but retains period filters. This is all-product share, not selected-product share.
Example 2 — January-to-February cohort retention
January to February Retention =VAR JanCustomers = CALCULATETABLE(VALUES(Sales[CustomerID]), REMOVEFILTERS(Periods), Periods[MonthStart] = DATE(2025,1,1), KEEPFILTERS(Sales[Units] > 0))VAR FebCustomers = CALCULATETABLE(VALUES(Sales[CustomerID]), REMOVEFILTERS(Periods), Periods[MonthStart] = DATE(2025,2,1), KEEPFILTERS(Sales[Units] > 0))VAR Returned = COALESCE(COUNTROWS(INTERSECT(JanCustomers, FebCustomers)), 0)RETURN DIVIDE(Returned, COUNTROWS(JanCustomers))January set {C1,C2}, February set {C1,C3}, intersection {C1}. Retention is 1/2 = 50%. In A context it is 1/1 = 100%, in B context 0/1 = 0%. These fixed-month measures ignore Periods filters and retain product filters, so use a labeled card or product matrix, not a time-series visual. VALUES produces unique IDs, preventing INTERSECT duplicates from inflating the numerator. A missing baseline gives BLANK. Only use zero returned when the follow-up period is certified complete.
Common mistakes — incompatible denominators
Adding distinct monthly counts double-counts customers who return. Counting February purchasers divided by January purchasers measures relative activity, not retention. New February customers do not belong in the January cohort numerator. A true acquisition cohort requires first-purchase history across the full relevant domain and an explicit definition of reactivation. Do not compare incomplete follow-up periods or sum cohort percentages across overlapping groups.
Practice — Change the follow-up month
Change the follow-up to March while keeping January fixed. Predict the numerator, denominator and retention; explain why the administrative C2 line does not qualify. Compare cumulative counts with monthly counts and explain why the March running-revenue total ignores a February-only start filter.
References and next steps
See DISTINCTCOUNT, INTERSECT and CALCULATE. Next chapter: present these KPIs with accessible, clearly labeled visuals.