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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AW1976NOVA
Post Patron
Post Patron

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

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.