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
Anonymous
Not applicable

Need Help Building 1-Many Relationship

Hey guys, I'm at my wits end trying to figure this problem for a report coming up so I really appreciate any guidance!

 

I'm trying to build a relationship in order to bridge 2 tables.  Table 1 contains healthcare data relating to individual patient information.  It has several columns that could seemingly provide a primary key with potential candidates such as Patient ID, Payment ID, and/or Account ID.  To clarify, in this first table each Patient ID will have a corresponding Payment ID and Account ID in nearby columns.  Each is individually unique.  

 

The second table is where I run into problems but I need this relationship in order to identify patterns within table 1 which produce the data in table 2.  Table 2 has far fewer columns but thousands more rows because it contains the data for services provided for each patient in the first table.  It contains Patient ID, Account ID, and Payment ID's from table 1.  Each patient may have as many as 30 charges so obviously there are tons of duplicates values in the Patient ID, Payment ID, and Account ID columns which seems to prevent me from building this relationship.

 

I've attempted to concatenate a new unique index column and bridge them that way amongst other things but I can't seem to figure this out.  Thanks in advance to any and all guidance with this! You'd be my hero

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

Hi,

 

According to your description, i create two tabls to test:

42.PNG41.PNG

And they are many-to-many relationships, so i create a calculated table as a demension table to connect these two tables:

Table = DISTINCT(SELECTCOLUMNS(Patient,"PatientID",Patient[PatientID],"PaymentID",Patient[PaymentID],"AccountID",Patient[AccountID]))

It shows:

43.PNG

Manage their relationships by column [PatientID] and it shows:

45.PNG

 

Hope this hepls.

 

Best Regards,

Giotto Zhi

 

View solution in original post

1 REPLY 1
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i create two tabls to test:

42.PNG41.PNG

And they are many-to-many relationships, so i create a calculated table as a demension table to connect these two tables:

Table = DISTINCT(SELECTCOLUMNS(Patient,"PatientID",Patient[PatientID],"PaymentID",Patient[PaymentID],"AccountID",Patient[AccountID]))

It shows:

43.PNG

Manage their relationships by column [PatientID] and it shows:

45.PNG

 

Hope this hepls.

 

Best Regards,

Giotto Zhi

 

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.