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

Automatically import One-to-one relationship with Direct Query

 

I'm trying to make it easier for our team to import tables to reports with the relationships already setup.  I was able to create relationships by using foreign keys in the underlying datasources sql schema.  However, ideally there are some relationships that should import as one-to-one (currently they are only showing up as one to many).

 

I tried creating a primary key on one table as the foreign key of another table with a unique contraint.  This still imports as one to many.  Is there any way to get DirectQuery tables to have a one-to-one relationship automatically recognized?

 

*Edit* further clarification, it's truely a 1 to zero or 1 as it's possible for there to be no record for some primary key values in the table w/ the foreign key

 

Thanks!

-Kevin

 

2 REPLIES 2
lbendlin
Super User
Super User

there are several warning flags in what you describe.

 

Usually 1:1 relationships mean that you should have combined the tables at the source.  Having blank values on either end of the relationship is highly un-recommended.

Anonymous
Not applicable

Hi, so there is a simple reason why my schema has this.  Basically I have dozens of tables that relate to a user table by a userid.  Those tables referencing users will either have no record for a user, or a single record for a user.

 

But lets focus on the actual question - Is it possible in power bi to have relationships automatically import as one-to-one using direct query?

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 Kudoed Authors