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
kasiaw29
Resolver II
Resolver II

If Statement with Related error message

Hi all, 

 

I have two tables - table 1 = Sales Contract and table 2 = AFP. 

I have a many to many relationship between them going in both directions. 

I have put data that I want to see in a table and it appears like so and is correct when compared to data from it's original source:2020-06-11_12-58-40.jpg

I've created a calculated column as such: 

On Schedule = IF('AFP'[DATE_PAID] <= RELATED('Sales Contract'[PAYMENT REQUIRED DATE]),"YES","NO")
Just want to find out if things are paid on time... but I'm getting the following error:
The column 'Sales Contract Items[PAYMENT REQUIRED DATE]' either doesn't exist or doesn't have a relationship to any table available in the current context.

 

What seems to be wrong? Does the direction of relationship needs changed? In above table it all look right and returns the right information but I can't seem to use two different dates to compate them to see if things are one time. 

 

Any help would be madly appreciated. 

Thanks 

2 REPLIES 2
amitchandak
Super User
Super User

@kasiaw29 , I doubt it will work in many to many.

You can bring data like this from one table to another

City Name = maxx(FILTER(geography,geography[City Id]=Sales[City Id]),geography[City])

HotChilli
Super User
Super User

"the function follows an existing many-to-one relationship to fetch the value from the specified column"

RELATED won't work on a many to many relationship.

Generally, we don't like many-to-many relationships (they require careful handling) .  So can you re-appraise your model and see if it's correct.

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