cancel
Showing results for
Did you mean:
Regular Visitor

## IF statement between tables with a many to many relationship

Hello

I have two tables that have a many to many relationship as I have no distinct value in either table. I am trying to add an extra column to table A using a IF statement to reference table B.

The formula doesn't work unfortunately. I get the error message "UUID cannot be found" I'm trying to use

IF('TableA'[UUID]=Related(TableB[UUID])&&'TableA'[PRODUCT]=RELATED('TableB'[PRODUCT]),"YES","NO")

Maybe someone out there can help?

Thanks

Joe

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Regular Visitor

## Re: IF statement between tables with a many to many relationship

Thanks guys

I have managed to do by using the Lookup function. Thanks for replying.

= IF (
COUNTROWS (
FILTER ( TableB, 'TableA'[UUID]= TableB[UUID] && 'TableA'[PRODUCT] = TableB[PRODUCT] )
)
> 0,
"YES",
"NO"
)
3 REPLIES 3
Super Contributor

## Re: IF statement between tables with a many to many relationship

You cannot use RELATED in presence of a Many-To-Many Relationship.

It can only be used in the presence of a One-To-Many Relationship within the table which is on the Many side of the relationship.

Proud to be a Datanaut!

Established Member

## Re: IF statement between tables with a many to many relationship

Hi @PoweredOut,

How about creating a calculated table first to have unique values. If you can share some sample of your data and what reuslt you expect, it will help getting to the solution fast.

Regards,

Affan

Highlighted
Regular Visitor

## Re: IF statement between tables with a many to many relationship

Thanks guys

I have managed to do by using the Lookup function. Thanks for replying.

= IF (
COUNTROWS (
FILTER ( TableB, 'TableA'[UUID]= TableB[UUID] && 'TableA'[PRODUCT] = TableB[PRODUCT] )
)
> 0,
"YES",
"NO"
)

Announcements

#### Community Highlights

Find out what's new in the Power BI Community!

#### Power Platform Summit North America

Register by September 5 to save \$200

#### Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 92 members 1,820 guests
Recent signins: