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
heidibrak
New Member

Relationship model: PostgreSQL and composite keys

Hello everyone,

 

I've got a PostgreSQL connected to PowerBI and my db looks like this - reduced to the relevant parts:

 

Table 1: Its id, let's call it id1 is the Primary Key.

Table 2: id1 is the Foreign Key referencing id1 from Table 2. Its Primary Key is a composite key consisting of id1 AND id2

Table 3: id1+id2 is the Foreign Key and id1+id2+id3 is the Composite Primary Key of Table 3.

 

When I connect to the db via PowerBI and look at the relationships there's a one:many relationship between Table 1 and Table 2, just as I want. There's no relationship between Table 2 and Table 3 though and the little info I've found on this issue seems to be quite old. Can anyone confirm that this does NOT work automatically and needs to fixed manually after connecting to the database?

Unfortunately I need my PowerBI users to be able to use the db without fixing something beforehand. 

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

Hi @heidibrak ,

Regarding your question, in Power BI, you need a column to establish a relationship between tables (compound keys containing multiple columns are not supported), you need to merge all the columns contained in the compound key into a single column. You can do this in Power Query.

vzhouwenmsft_0-1711606813481.png

You can then publish the modified .pbix file to Power BI Service to share it with your users, and they won't have to modify it manually.

Best Regards,
Wenbin Zhou
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

1 REPLY 1
v-zhouwen-msft
Community Support
Community Support

Hi @heidibrak ,

Regarding your question, in Power BI, you need a column to establish a relationship between tables (compound keys containing multiple columns are not supported), you need to merge all the columns contained in the compound key into a single column. You can do this in Power Query.

vzhouwenmsft_0-1711606813481.png

You can then publish the modified .pbix file to Power BI Service to share it with your users, and they won't have to modify it manually.

Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.