cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HAL
Regular Visitor

Promote Autodetect Relationships

Hello Power BI Community:

When designing my database schema, I would like to name the columns so that Power BI's "autodetect" feature for relationships works perfectly and unambiguously. I could not find many meaningful hints in the documentation so far.

I am glad for any suggestions or information how the algorithm works.

Thanks,

Hal.

1 REPLY 1
ankitpatira
Community Champion
Community Champion

@HAL I have dealt with these scenario a lot. In my experience powerbi desktop when loading data will use column names to determine if there is a relationship between two tables. For exampel you have customerID column in one table and customerID in another it will be related. However it will also look at the data so essentially determining PK FK principles. 

 

Through lot of testing I've found a solution that has been working for me so far. Even though if you design your database properly and have all necessary PK FK relations powerbi desktop hasn't always automatically created them all. In my case I had a lot PK FK relations in database that had more than 30 tables. To avoid any manual work and manually creating relationships in powerbi desktop, I have initially used DirectQuery feature to connect to my database (I had sql server db and so DirectQuery is supported). With DirectQuery no data is imported in powerbi desktop and it maintains all PK FK relations you have in your database. Once connected save your pbix file (without doing any further work on visuals).  

 

Next time you open that pbix file you will have button on bottom left hand corner saying DirectQuery enabled click here to change. Using that change it to import. This will load data from your tables into powerbi desktop but will maintain all PK FK relations and so you've avoided any missing out of relations that would had to be done manually.

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.