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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AliceW
Impactful Individual
Impactful Individual

New column in a table based on another table in a one-to-many relationship

Hi everyone,

I can't figure this out, and so your help would be very much appreciated.

What I have:

I have one table, 'Account', in a one-to-many relationship with another table, 'Opportunities'.

There are two relationships, both one-to-many:

- Account ID to Billing Account ID (active relationship);

- Account ID to Supported Account ID;

An Account ID in the 'Account' table can have zero, one, ore more Opportunities.

 

What I need:

Another column in the 'Account' table which gives a 'Yes' when the Account ID is linked to at least one Supported Account ID and 'No' when it does not.

 

What I've tried:

RELATED and USERELATIONSHIP. The latter because I need to use the non-active relationship.

 

Could a table function work? If the Supported Account ID count is >0 or not blank, then 'Yes'? They are my weak point.

 

Big thanks in advance,

Alice

1 ACCEPTED SOLUTION

Certainly...

IF(
	CALCULATE(
		COUNTROWS(RELATEDTABLE(Opportunities)),
		USERELATIONSHIP(I don't know the keys so insert here)
	) > 0,
	TRUE(),
	FALSE()
)

View solution in original post

6 REPLIES 6
AliceW
Impactful Individual
Impactful Individual

It was such a big blocker for me - I really appreciate you taking the time to help me out.

littlemojopuppy
Community Champion
Community Champion

De nada...glad I could help!

littlemojopuppy
Community Champion
Community Champion

Try this...

IF(
	COUNTROWS(RELATEDTABLE(Opportunities)) > 0,
	TRUE(),
	FALSE()
)

Thank you! Any thoughts on how to implement USERELATIONSHIP? I need to use the non-active relationship between the tables...

Certainly...

IF(
	CALCULATE(
		COUNTROWS(RELATEDTABLE(Opportunities)),
		USERELATIONSHIP(I don't know the keys so insert here)
	) > 0,
	TRUE(),
	FALSE()
)

THANK YOU, Mojo!!

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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