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
El_Ha
Frequent Visitor

Relationship direction keeps changing itself

Hello,

 

Not sure if I am missing something simple here or if this a bug that has not been addressed but I have a basic report to make with 2 tables:

 

Contact table ( a table of contacts and their basic info)

Jobs table (a table of available volunteer jobs, this includes 2 references to contact Ids (Client and Volunteer))

 

I am trying to make a relationship FROM contacts(Id) TO jobs(Volunteer__c), and powerBI does allow me to do this, however as soon as I exit the relationships window it will swap the FROM and TO around which is causing a headache as I wanted to use the RELATED function to grab only contacts with a related job record.

Not all contacts have a related job record so maybe this is the issue it is facing, if so how can I get all the contacts that have their Id present in the Volunteer__c field in the jobs table?

 

I found this topic in another thread but it doesnt seem to have an answer and was posted some time ago:

https://community.powerbi.com/t5/Desktop/issue-with-relationship-between-quot-to-quot-and-quot-from-...

 

Any assistance is greatly appreciated.

 

Thanks,

El

 

1 ACCEPTED SOLUTION

Hi @El_Ha ,

 

The Related wotrks from the many to one side so in you case you are making the formula incorrectly. Let's break down the calculation you need.

 

You want all the Jobs that exist for a contact correct.

If you pick up you contact first you get a single value and then you try on the line to place all the related lines of Job this is not possible because you are getting a multiple value for each line so the result is an error.

 

If you do the other way around starting from the Jobs you are getting for each line of the job a single line of the Contact so this is possible and returns a value.

 

Is  a question of logic you cannot park 2 cars in a single space (sorry for the comparision).


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
El_Ha
Frequent Visitor

Ahh yes I see what you mean now, so I'll just have to build the data I need from the job records then - good to know the visual bug wasnt the issue too 😅

 

Really helpful thank you again!

 

MFelix
Super User
Super User

Hi @El_Ha ,

 

Is this a one to many relationship?

 

When you refer that things are getting swapped do you mean that you see the many side on top of the relationship visualization?

 

I believe this is only a visual bug, because if you look at the bottom where there is the relationship type you should have many to one (so its also inverted) also check if the arrow direction on the relationship view is correct.

 

If the arrow is correct and the relationship type is also correct based on the order of the tables you are viewing everything is correct. (admit is frustrating the first times because it's not natural)


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



El_Ha
Frequent Visitor

Hello,

 

Thank you for the help.

Yes this was a one to many where 1 contact id may be set as a volunteer__c on many jobs.

Getting exactly the same issue as in that other thread I linked:

 

After making the relationship, before pressing close:

El_Ha_1-1601293383725.png

After closing:

 

El_Ha_3-1601293484705.png

El_Ha_4-1601293501725.png

El_Ha_5-1601294032855.png

 

 

 

Is it at all possible this would affect the DAX? I can't seem to get the RELATED() function to work when using it with something like

table=FILTER(Contact,RELATED('Volunteer Job'[Id])<>'x')

but RELATED() will work when I use it the other way around (FROM Job TO Contact) in something like:

table=FILTER(Volunteer Job,RELATED('Contact'[Id])<>'x')

Its possible I am just writing this completely wrong though.

I am just trying to achieve a table where I can see all contacts that have job records only.

 

 

Thanks,

El

 

 

 

 

Hi @El_Ha ,

 

The Related wotrks from the many to one side so in you case you are making the formula incorrectly. Let's break down the calculation you need.

 

You want all the Jobs that exist for a contact correct.

If you pick up you contact first you get a single value and then you try on the line to place all the related lines of Job this is not possible because you are getting a multiple value for each line so the result is an error.

 

If you do the other way around starting from the Jobs you are getting for each line of the job a single line of the Contact so this is possible and returns a value.

 

Is  a question of logic you cannot park 2 cars in a single space (sorry for the comparision).


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.