Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Allisond
Advocate II
Advocate II

Distinct Count of Measure

Hello, All,

 

I am a rookie with PowerBI and am trying to create a measure that will calculate the distinct count of a result of another measure.   Is there any way to do this?  

 
This is my measure.  It will return only patients with a particular value.  I am wanting to get the distinct patientIDs from this measure, but can't for the life of me figure it out. 
 
Measure 2 = SWITCH(TRUE(), [TestValue] = 1, VALUES(MasterPt[PatientID]))
 
Any help would be so appreciated.
4 REPLIES 4
Anonymous
Not applicable

Hi @Allisond 

Could you tell me if your problem has been solved? If it is, kindly Accept the helpul reply as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

amitchandak
Super User
Super User

@Allisond , Try a measure like

Measure 2 = calculate(distinctcount(MasterPt[PatientID]), filter(MasterPt,MasterPt[TestValue] = 1))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

My [Test Value] is a measure and dax error results.   Is there any way to do this using a measure that references the MasterPt table?

Anonymous
Not applicable

Hi @Allisond 

In your measure VALUES(MasterPt[PatientID] will return to a table instead of single values so your measure will show error.

Try

If([TestValue]=1, Max(MasterPt[PatientID),blank())

If this reply still couldn't help you solve your problem, please provide me a sample data that may make it easier for me to understabd your data model.

Or you can share your pbix file with me by your Onedrive for Business.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors