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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sjrrkb123
Helper III
Helper III

Calculated Column to check if a person has two specific roles for a given project

Suppose I Have three columns, Name, Role, & Project that look like this

ProjectRoleName
AOwnerShane
AHelperShane
ASellerBill
B

Owner

Shane

B

HelpEric

B

SellerBill

C

Owner

Jenna

C

OwnerEric

C

HelpBob

C

SellerEric

 

I want to add a calculated column that states if a person has the role of Owner and Helper,  it has a "Yes" else it is Blank. I person can more than 1 role in a project but I only care if they have both roles of Owner and Helper. So it would look like the following:

ProjectRoleNameDup Role Check
AOwnerShaneYes
AHelperShaneYes
ASellerBill 
B

Owner

Shane 

B

HelpEric 

B

SellerBill 

C

Owner

Jenna 

C

OwnerEric 

C

HelpBob 

C

SellerEric 

 

 

How would I go about doing this?

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @sjrrkb123 

create a measure like

Dup Role Check = 
var _isRoleOwner = IF(CALCULATE(COUNTROWS(Table), ALLEXCEPT(Table, Table[Name], Table[Project]), Table[Role]="Owner") > 0, TRUE(), FALSE() )
var _isRoleHelper = IF(CALCULATE(COUNTROWS(Table), ALLEXCEPT(Table, Table[Name], Table[Project]), Table[Role]="Helper") > 0, TRUE(), FALSE() )

RETURN

IF(_isRoleOwner && _isRoleHelper, "Yes", BLANK())

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
camargos88
Community Champion
Community Champion

Hi @sjrrkb123 ,

 

Try this measure:

Check = IF(CALCULATE(DISTINCTCOUNT('Table'[Role]); 'Table'[Role] in {"Owner";"Helper"}; ALLEXCEPT('Table';'Table'[Name];'Table'[Project])) = 2;"Yes"; BLANK())
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



az38
Community Champion
Community Champion

Hi @sjrrkb123 

create a measure like

Dup Role Check = 
var _isRoleOwner = IF(CALCULATE(COUNTROWS(Table), ALLEXCEPT(Table, Table[Name], Table[Project]), Table[Role]="Owner") > 0, TRUE(), FALSE() )
var _isRoleHelper = IF(CALCULATE(COUNTROWS(Table), ALLEXCEPT(Table, Table[Name], Table[Project]), Table[Role]="Helper") > 0, TRUE(), FALSE() )

RETURN

IF(_isRoleOwner && _isRoleHelper, "Yes", BLANK())

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.