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
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
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.