Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
DAX measure to show which patient has completed a 'cosmetic' treatment within 4 weeks of completing an 'examination' treatment.
E.g. an examination on the 01/02/2023 and cosmetic on the 10/02/2023 would be marked as 1 whereas if the examination happened on 01/02/2023 and 'cosmetic' on the 20/03/2023, it would be marked as 0. A patient may also have a future examination and future cosmetic so it should pick up those as well.
Patientkey is in 'treatments' table but 'patient name' is from the 'patients' table. Rest of the columns are in 'Treatments'
| PatientKey | Completed Date | Patient Name | Treatment Category | No. of Items | |
| 1 | 11/01/2023 12:20 | A | Examinations | 1 | |
| 1 | 14/02/2023 13:18 | A | Cosmetic | 1 | |
| 1 | 07/03/2023 15:59 | A | Examinations | 1 | |
| 1 | 29/03/2023 15:50 | A | Treatment Stages | 1 | |
| 1 | 29/03/2023 15:50 | A | Restorative | 1 | |
| 1 | 17/04/2023 15:54 | A | Prosthodontics | 1 | |
| 1 | 17/04/2023 15:54 | A | Prosthodontics | 1 | |
| 2 | 12/01/2023 15:42 | B | Orthodontics | 1 | |
| 2 | 12/01/2023 15:44 | B | Orthodontics | 1 | |
| 2 | 01/03/2023 16:34 | B | Examinations | 1 | |
| 2 | 01/03/2023 16:39 | B | Miscellaneous | 1 | |
| 2 | 01/03/2023 16:39 | B | Orthodontics | 1 | |
| 2 | 01/03/2023 16:39 | B | Orthodontics | 1 | |
| 2 | 02/03/2023 15:16 | B | Miscellaneous | 1 | |
| 2 | 02/03/2023 17:03 | B | Miscellaneous | 1 | |
| 2 | 09/03/2023 14:37 | B | Examinations | 1 | |
| 2 | 03/04/2023 16:58 | B | Miscellaneous | 1 | |
| 2 | 25/04/2023 09:47 | B | Examinations | 1 | |
| 2 | 28/06/2023 13:00 | B | Examinations | 1 | |
| 2 | 28/06/2023 13:00 | B | Non-Clinical Services | 1 | |
| 2 | 30/06/2023 13:09 | B | Examinations | 1 | |
| 2 | 30/06/2023 13:09 | B | Treatment Stages | 1 | |
| 2 | 14/07/2023 12:51 | B | Cosmetic | 1 |
Hi @shug - Try the below calculated columns and measure with flag as patient has completed a 'cosmetic' treatment within 4 weeks of completing an 'examination' treatment., if still issue not resolved.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 66 | |
| 47 | |
| 43 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 196 | |
| 127 | |
| 102 | |
| 67 | |
| 49 |