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
Niiru1
Helper V
Helper V

Create join table for many to many relationship DAX SUMMARIZE

I have two tables:
Assignment Table

ASSIGNMENT_IDEFFECTIVE_START_DATEEFFECTIVE_END_DATEPERSON_ID
2012712/08/201618/08/201619547
2012722/09/201725/09/201719547
1015304/03/201930/04/201915760

 

Employee Table:

PERSON_IDDATE_STARTDATE_END
12306/05/201426/06/2014
1954711/03/201916/03/2019
1954712/01/201817/01/2018

 

However when trying to create a relationship it says:

This relationship has cardinality Many-Many. This only be used if it is expected that neither column (PERSON_ID and PERSON_ID) contains unique values, and that the significantly different behaviour of Many-Many relationships is understood.

 

Is it possible to create a join table from a DAX query e.g. summarize table?t

 

Thanks

 

See file attached.

https://www.dropbox.com/s/2rv8is5q63g30td/PERSON_ID%20MANY%20TO%20MANY.pbix?dl=0

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Niiru1 ,

You can create a calculated table as below:

Table =
VAR assignm_TreatAs =
    TREATAS (
        'Employee Table',
        'Assignment Table'[PERSON_ID],
        'Employee Table'[DATE_START],
        'Employee Table'[DATE_END]
    )
RETURN
    NATURALLEFTOUTERJOIN ( assignm_TreatAs, 'Assignment Table' )

Or you can achieve it by Merge Queries in Power Query.

How to Change Joining Types in Power BI and Power Query

Create join table for many to many relationship DAX SUMMARIZE.JPG

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hi @Niiru1 ,

You can create a calculated table as below:

Table =
VAR assignm_TreatAs =
    TREATAS (
        'Employee Table',
        'Assignment Table'[PERSON_ID],
        'Employee Table'[DATE_START],
        'Employee Table'[DATE_END]
    )
RETURN
    NATURALLEFTOUTERJOIN ( assignm_TreatAs, 'Assignment Table' )

Or you can achieve it by Merge Queries in Power Query.

How to Change Joining Types in Power BI and Power Query

Create join table for many to many relationship DAX SUMMARIZE.JPG

Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

From the Employee Table, create a Table with only 1 column of unique Person_ID's.  This can easily be done in the Query Editor.  Now link each of your source data tables to this single column unique employee ID table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Niiru1 

You might need a bridging table in between when doing Many to Many relationships in Power BI.

 

Can you have a look at-

https://radacad.com/many-to-one-or-many-to-many-the-cardinality-of-power-bi-relationship-demystified

 

Hope this helps

 

Cheers,

-Namish B

smpa01
Super User
Super User

@Niiru1 what is the end result you are hoping for?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.