Concept Flow
Order Date Column (B) --> Extract Month --> Compare to Earliest Month --> Assign Cohort Label
The cohort analysis groups orders by the month of their order date compared to the earliest order month in the data.
Order Date Column (B) --> Extract Month --> Compare to Earliest Month --> Assign Cohort Label
IF DATEPART('month', [Order Date]) = DATEPART('month', {MIN([Order Date])}) THEN 'Cohort 1' ELSE 'Cohort 2+' ENDThis Tableau formula checks if the order month matches the earliest order month and assigns cohort labels accordingly.
| Customer ID | Order Date | Revenue | Order Month | Earliest Month | Cohort |
|---|---|---|---|---|---|
| C001 | 2023-01-15 | 100 | 1 | 1 | Cohort 1 |
| C002 | 2023-01-20 | 150 | 1 | 1 | Cohort 1 |
| C001 | 2023-02-10 | 200 | 2 | 1 | Cohort 2+ |
| C003 | 2023-02-15 | 300 | 2 | 1 | Cohort 2+ |
| C002 | 2023-03-05 | 250 | 3 | 1 | Cohort 2+ |
| C004 | 2023-03-10 | 400 | 3 | 1 | Cohort 2+ |
| Variable | Value | Explanation |
|---|---|---|
| MIN([Order Date]) | 2023-01-15 | Earliest order date in dataset |
| DATEPART('month', [Order Date]) | Varies per row (1,2,3) | Extracts month number from each order date |
| DATEPART('month', MIN([Order Date])) | 1 | Month number of earliest order date |
| Cohort Label | 'Cohort 1' or 'Cohort 2+' | Assigned based on month comparison |