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
Anonymous
Not applicable

Create a Measure: Count distinct values (of a field) if certain criteria of another field are met

Hi,

 

I've brought a table into Power BI and expanded it (in order to create an additional row for every day between two different date fields.  I needed to do this so I could count how many Members were part of a healtcare plan for any portion of the year).  I then went ahead and created my Date/Calendar table and created the relationships.  Everything is working properly:

 

2.PNG

 

However, I'm now trying to create an additional measure on a table visual and I'm struggling with this.  Here is my current table:

 

1.PNG

I'd like to create a New Measure called "Employee"...where it will count distinct Member IDs.  Currently, the Members column in the table visual above is counting distinct values of the 'NovaDailyEligibilityExtract'[Member ID] field.  The New Measure I'd like to create should count distinct values of the 'NovaDailyEligibilityExtract'[Member ID] field...but only if my 'NovaDailyEligibilityExtract'[Relationship] field = Employee.

 

What is the formula to create this New Measure?

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

Can you please try something like

 

X=

CALCULATE(DISTINCTCOUNT('Table'[<column to count>]), FILTER('Table','Table'[<column to filter>]="Emp"))
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

2 REPLIES 2
smpa01
Super User
Super User

Can you please try something like

 

X=

CALCULATE(DISTINCTCOUNT('Table'[<column to count>]), FILTER('Table','Table'[<column to filter>]="Emp"))
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

That worked perfectly.  Filter is such a powerful and useful tool.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.