Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Bensheepero
Regular Visitor

Creating Multiple manage relationships at ones

Hi everyone,

I have an issue where I have over 50+ tables in my report. I need to create a link between the date/time columns of these tables and my lookup date and time tables respectively. Now I can do them 1 by 1, but the report is so large that it takes approximately 10 seconds for each. Is there any way with which (perhaps Tabular editor) that I can write a script that does this automatically for me for all the tables. FYI - The automatic relationship option in power bi is not a feasible option for me. 

2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @Bensheepero ,

 

You can use the TMDL script options to generate your relationships in Power BI desktop. If you do one of the relationship than use the TMDL script to get the code and use chat GPT or another AI tool.

 

The scripts on TMDL are basically like this:

createOrReplace

	relationship 22d0e674-7082-40ae-d047-70859390746a
		fromColumn: Table.Column
		toColumn: CalendarTable.Date

 

So using this you can do a similar AI promtp:

Can you generate the TMDL for relationships based on the srcipt below, I want to relate the table Calendário and column Data with the following tables:
Table 1 column Data
Table 2 Column Data

Don't forget to generate a single script and also include specific guid for the relationship

TMDL script example

createOrReplace

	relationship 22d0e674-7082-40ae-d047-70859390746a
		fromColumn: Table.Column
		toColumn: CalendarTable.Date

Then you just need to copy paste and run it.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

Hi @Royel ,

 

The GUID is a unique value that can be any text value it does not have to be a specific format, in some type of fields it can even be deleted and the model will continue to work, in this case you need to add some text.

 

Has I refer you need to use the prompt in AI to give you specific GUID, but if you do it manually you can just add any GUID you want see the  gif below:

Relationship.gif

 

However in the TMDL viewer for specific object lineage tag that is also a GUID can be automatically generated. And depending on the type of object even repeated, for measure you need to have specific GUID (lineagetag) for Columns you can have the same.

MFelix_0-1757584953150.png

MFelix_1-1757585017010.png

Based in this you can have several options:

  • Use AI to generate the several GUID
  • Generate them in a random excel file
  • DO a combination of table names and columns

Has reference the main thing you need to be carefull is that they are unique in the same type of element in this case relationship.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

8 REPLIES 8
v-sgandrathi
Community Support
Community Support

Hi @Bensheepero,

Thank you @MFelix@Mvsainathareddy and @Royel for your responses to the query.

We wanted to follow up since we haven't heard back from you regarding our last response. We hope your issue has been resolved.

If you need any further assistance, feel free to reach out.

 

Thank you for being a valued member of the Microsoft Fabric Community Forum!

Hi @Bensheepero,

 

I wanted to follow up on our previous suggestions regarding the issue. We would love to hear back from you to ensure we can assist you further.

Please let us know if there’s anything else we can do to help.

 

Thank you.

Hi @Bensheepero,

 

Just looping back one last time to check if everything's good on your end. Let me know if you need any final support happy to assist if anything’s still open.

 

Thank you.

MFelix
Super User
Super User

Hi @Bensheepero ,

 

You can use the TMDL script options to generate your relationships in Power BI desktop. If you do one of the relationship than use the TMDL script to get the code and use chat GPT or another AI tool.

 

The scripts on TMDL are basically like this:

createOrReplace

	relationship 22d0e674-7082-40ae-d047-70859390746a
		fromColumn: Table.Column
		toColumn: CalendarTable.Date

 

So using this you can do a similar AI promtp:

Can you generate the TMDL for relationships based on the srcipt below, I want to relate the table Calendário and column Data with the following tables:
Table 1 column Data
Table 2 Column Data

Don't forget to generate a single script and also include specific guid for the relationship

TMDL script example

createOrReplace

	relationship 22d0e674-7082-40ae-d047-70859390746a
		fromColumn: Table.Column
		toColumn: CalendarTable.Date

Then you just need to copy paste and run it.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix  As far i know the GUID id needs to be unique, and TMDL can not generate this automatically. 

relationship 22d0e674-7082-40ae-d047-70859390746a

 Any thoughts? 

Thanks 

Hi @Royel ,

 

The GUID is a unique value that can be any text value it does not have to be a specific format, in some type of fields it can even be deleted and the model will continue to work, in this case you need to add some text.

 

Has I refer you need to use the prompt in AI to give you specific GUID, but if you do it manually you can just add any GUID you want see the  gif below:

Relationship.gif

 

However in the TMDL viewer for specific object lineage tag that is also a GUID can be automatically generated. And depending on the type of object even repeated, for measure you need to have specific GUID (lineagetag) for Columns you can have the same.

MFelix_0-1757584953150.png

MFelix_1-1757585017010.png

Based in this you can have several options:

  • Use AI to generate the several GUID
  • Generate them in a random excel file
  • DO a combination of table names and columns

Has reference the main thing you need to be carefull is that they are unique in the same type of element in this case relationship.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks a lot, you help me to learn new technique. 

Mvsainathareddy
Advocate II
Advocate II

Hi @Bensheepero 

Use Tabular Editor from Power BI Desktop
Even though you're in Power BI Desktop, you can still use Tabular Editor 2 or 3 via the External Tools ribbon:

Open your report in Power BI Desktop.
Go to External Tools → Tabular Editor.
Run the script to auto-create relationships.
This is the most efficient method and works directly on your Power BI model.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors