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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
I am trying to get compliance whether the patient took a drug screen or not. Here are some example data:
For clinic A the compliance is 87.5%, 7 (number of distinct patients who took a drug screen)/8 total number of distinct patients in clinic A. For clinic B the compliance is 50% (1/2).
Is there a way to do this with dax? Please reach out if you need additional information.
Solved! Go to Solution.
@ranis1227 , try measure
Divide(calculate(sum(Table[patients]), filter(Table, Table[drugscreen] = "Y")),sum(Table[patients]))
Hi @ranis1227 ,
You may try this Measure.
compliance =
VAR PatientsWithGrugScreen =
CALCULATE (
[Distinct Count Patients],
FILTER ( DrugScreen, DrugScreen[GrugScreen] = "Y" )
)
VAR ClinicPatients =
CALCULATE ( [Distinct Count Patients], VALUES ( DrugScreen[Department] ) )
RETURN
DIVIDE ( PatientsWithGrugScreen, ClinicPatients )
The result looks like this.
Also, attached the pbix file as reference.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Thank you very much. This works perfectly.
@ranis1227 , try measure
Divide(calculate(sum(Table[patients]), filter(Table, Table[drugscreen] = "Y")),sum(Table[patients]))
Amit,
I tried it and it worked for the sum of total patients.
However, I need it for the distinct number of patients. I used
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 17 | |
| 14 | |
| 13 |