Forum Discussion

Bensheepero's avatar
Bensheepero
Regular Visitor
11 months ago
Solved

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...
  • MFelix's avatar
    11 months ago

    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.

     

  • MFelix's avatar
    MFelix
    11 months ago

    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:

     

    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.

    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.