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

HELP Required :: Related Tables DAX Query :: New column based on Text

Hello Power BI champions

 

I have two Related tables Table A to Table B ( 1 to many )

 

 

Table A - With Product IDs ( Unique ) and one Entry per Product  ID 

 

Table B - With multiple entries of the same Product IDs with their related part Numbers and at part Level compliance YES or NON-C

Based on that data  

 

I want to have one column against each unique Product ID in Table- A if any of the active parts are NON-C for that Product ID in Table B, then the whole product will become Not  Compliance in Table A

 

 

Table A 

Product ID

19CB001

19IT500

18NP001

19IT001

19IT005

 

 

Table B 

 

Product ID

 Part ID 

Part State 

Part  Compliance

19CB001

1

Active

YES

19CB001

2

Active

YES

19CB001

3

Active

NON-C

19IT500

1

Active

YES

19IT500

2

Active

YES

19IT500

3

Closed

NON-C

19IT500

4

Active

YES

18NP001

1

Hold

YES

18NP001

2

Hold

NON-C

19IT001

1

Active

NON-C

19IT005

1

Active

YES

 

 

Table C:: Desired Output

 

Product ID

Desired Results

19CB001

Not Compliance

19IT500

Compliance

18NP001

Compliance

19IT001

Compliance

19IT005

Compliance

 

Thanks 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

[Product Compliance] = -- calculated column
var __prodID = TA[Product ID]
var __notCompliant =
	NOT ISEMPTY(
		FILTER(
			RELATEDTABLE( TB ),
			TB[Part State] = "active"
			&&
			TB[Part Compliance] = "non-c"
		)
	)
return
	if ( __notCompliant, "Not Compliant", "Compliant" )

Best

Darek

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

[Product Compliance] = -- calculated column
var __prodID = TA[Product ID]
var __notCompliant =
	NOT ISEMPTY(
		FILTER(
			RELATEDTABLE( TB ),
			TB[Part State] = "active"
			&&
			TB[Part Compliance] = "non-c"
		)
	)
return
	if ( __notCompliant, "Not Compliant", "Compliant" )

Best

Darek

Anonymous
Not applicable

its showing True or False , which i converted later , thanks for the help , appreciated 

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.

Top Solution Authors