35. More Real-World Project Briefs
35.8 Customer Analytics and a Simple Cohort
Business question. Who bought in more than one month, and which join-month cohort still bought in a later month?
Tables. Order (Order ID, Date, Customer, City, Amount). Customer (Customer, City, First Order Date). Use only the class names. Date.
Measures.
Customers = DISTINCTCOUNT(Order[Customer])
Repeat Customers =
COUNTROWS(FILTER(VALUES(Order[Customer]), [Orders] > 1))
Repeat % = DIVIDE([Repeat Customers], [Customers])
[Orders] is DISTINCTCOUNT(Order[Order ID]) in this brief.
Cohort, kept small. A cohort is the set of customers who share a start month. Add Cohort Month on Customer from First Order Date (Power Query, start of month). A matrix with Cohort Month on rows and order month on columns, and [Customers] in values, shows how many of that start group ordered later. It will be sparse on ten people. That is fine. Do not smooth it.
Pages. Cards: Customers, Repeat %. A matrix for the cohort. A bar of sales by customer. A city slicer.
Sample layout — fictional data. The picture uses the worked rows in this brief. It does not add a table.
Fictional read: Ruhi Bagale's first order is in January in Pune, and she orders again in March. She is in the January cohort and appears in the March column. Amir orders only in February in Nagpur. He is a February cohort with one column. If Ruhi appears in every cohort, First Order Date is calculated with a measure that still sees the visual filter. Compute First Order Date in Power Query so it does not move.
Worked rows (fictional sample data). First order month is a column, not a measure (see the warning above).
| Customer | City | Order month | Amount | First order month |
|---|---|---|---|---|
| Ruhi Bagale | Pune | Jan | ₹500 | Jan |
| Ruhi Bagale | Pune | Mar | ₹700 | Jan |
| Zoya | Pune | Jan | ₹300 | Jan |
| Zoya | Pune | Feb | ₹200 | Jan |
| Rani | Nashik | Jan | ₹450 | Jan |
| Amir | Nagpur | Feb | ₹400 | Feb |
| Salman | Mumbai | Feb | ₹350 | Feb |
| Raja | Kolhapur | Mar | ₹600 | Mar |
Distinct customers are Ruhi, Zoya, Rani, Amir, Salman, Raja. That is 6. Repeat customers are people with more than one order: Ruhi and Zoya. That is 2. Repeat % is 2 ÷ 6 = 33.3%.
January cohort is Ruhi, Zoya, and Rani (3). In the March column of that cohort only Ruhi appears (1). Amir is a February cohort with one order. If Ruhi also appears in a February cohort, First Order Month was calculated under a visual filter. It must not move.
Starter file: brief_35_8_customer_orders.csv – the worked rows above as a CSV (fictional practice data). Load it with Get data › Text/CSV, build the measures, then check your cards.
Expected values to check
Distinct customers 6 · Repeat customers 2 · Repeat % 33.3% · January cohort 3
| Good KPI | Vanity metric | |
|---|---|---|
| From the same rows | Repeat 33.3% (2 of 6) | 8 orders |
| Why | Two customers came back. Four did not. | Eight orders makes the file look active. Rani, Amir, Salman, and Raja each bought once. |
What the manager does. The Pune manager asks what Zoya bought in February, because she is a repeat, and does not add a "win-back" campaign for Ruhi in the same breath without reading the row. The Nashik manager sees Rani once in January. She is not a repeat. A Nashik card that says "orders exist" is the vanity metric. The action is a second-order offer for Rani, or an honest blank repeat card.
Ravindra Bagale's Tip
A common mistake is FIRSTDATE inside the visual, so the cohort month changes when you click March. The first order must be fixed at refresh time, in a column. Do not let a measure change the cohort. Pay attention!
Ravindra Bagale's Tip – मराठी
एक common चूक म्हणजे visual मध्ये FIRSTDATE, म्हणजे March वर click केलं की cohort month बदलतो. पहिली order refresh च्या वेळीच column मध्ये ठरली पाहिजे. Measure ने cohort बदलू देऊ नका. लक्षात ठेवा!
Ravindra Bagale's Tip – हिंदी
एक common गलती है visual के अंदर FIRSTDATE, तो March पर click करते ही cohort month बदल जाता है. पहली order refresh के समय ही column में तय होनी चाहिए. Measure से cohort मत बदलने दो. ध्यान रखो!