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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Distinct Count of Projects Containing Specific Team Members

Hi All,

 

 

I have Roster table that has a column of Projects (repeating values) and I need to count how many Projects have been assigned multiple Job Titles.

 

For Instance:

 

PROJECTJOB TITLE
AlphaManager
AlphaMember
AlphaMember
AlphaTech
BetaManager
BetaTech
DeltaManager
DeltaMember
OmegaTech

 

I have been able to count how many PROJECTS contain one specific JOB TITLE using

Contains Manager = CALCULATE(DISTINCTCOUNT('Roster'[PROJECT]), FILTER('Roster', [JOB TITLE] = "Manager"))

 

However, I have not been able to count how many PROJECTS contain, say, "Manager" AND "Tech".

 

So in this instance I would need "2" to be returned, because only two projects, Alpha and Beta, have both a Manager and Tech assigned.

 

 

Thanks!

1 ACCEPTED SOLUTION

Hi,

the code:

Measure = 
var __Filter = CALCULATETABLE(FILTER('Table';[JOB TITLE] in {"Manager"; "Tech"});ALLEXCEPT('Table';'Table'[PROJECT]))
return 
IF(
    HASONEVALUE('Table'[PROJECT]);
        if(COUNTROWS(__Filter)>=2;1;0);
            COUNTROWS(
                FILTER(
                    CALCULATETABLE(SUMMARIZE(__Filter;'Table'[PROJECT];"c"; DISTINCTCOUNT('Table'[JOB TITLE])));[c]>=2
                    )
                )
)

As seen here:

pj.jpg

File.

Pls marks as solution if this works for you. Thumbs up for the effort would be great. 

Kind regards, Steve. 

View solution in original post

6 REPLIES 6
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this expression in your measure.  It returns 2 for your example data.  Replace ProjectRoles with the name of your actual table.

 

Projects with Manager and Tech =
COUNTROWS (
    FILTER (
        DISTINCT ( ProjectRoles[PROJECT] ),
        CALCULATE (
            DISTINCTCOUNT ( ProjectRoles[JOB TITLE] ),
            ProjectRoles[JOB TITLE] IN { "Manager", "Tech" }
        ) = 2
    )
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi,

the code:

Measure = 
var __Filter = CALCULATETABLE(FILTER('Table';[JOB TITLE] in {"Manager"; "Tech"});ALLEXCEPT('Table';'Table'[PROJECT]))
return 
IF(
    HASONEVALUE('Table'[PROJECT]);
        if(COUNTROWS(__Filter)>=2;1;0);
            COUNTROWS(
                FILTER(
                    CALCULATETABLE(SUMMARIZE(__Filter;'Table'[PROJECT];"c"; DISTINCTCOUNT('Table'[JOB TITLE])));[c]>=2
                    )
                )
)

As seen here:

pj.jpg

File.

Pls marks as solution if this works for you. Thumbs up for the effort would be great. 

Kind regards, Steve. 

Anonymous
Not applicable

Other than a few syntax issues (maybe I have an older version or something) this worked perfectly, thank you!

AntrikshSharma
Super User
Super User

Something like this?

 

 

Manger & Tech =
VAR Result =
    CALCULATE (
        DISTINCTCOUNT ( Michael[Job Title] ),
        FILTER (
            ALL ( Michael[Job Title] ),
            Michael[Job Title] IN { "Manager", "Tech" }
        )
    )
RETURN
    IF ( HASONEVALUE ( Michael[Project] ), Result, BLANK () )

 

You can also use less verbose version.

 

Manger & Tech =
VAR Result =
    CALCULATE (
        DISTINCTCOUNT ( Michael[Job Title] ),
        Michael[Job Title] IN { "Manager", "Tech" }
    )
RETURN
    IF ( HASONEVALUE ( Michael[Project] ), Result, BLANK () )

 

MM.PNG

 

Anonymous
Not applicable

Not quite. It looks like your code returns how many Managers and/or Techs are assigned to each project.

 

I need my code to return how many projects have a Manager and Tech assigned to them, so I can put it on a card.

 

So in this instance I would need "2" to be returned, because only two projects, Alpha and Beta, have both a Manager and Tech assigned.

is this how you want it?
aa1.PNGaa3.PNG

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.