Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |