Forum Discussion

Nemza's avatar
Nemza
Frequent Visitor
6 years ago
Solved

Trouble with relationships on simple data model

Hi there,    I'm struggling with a Power BI concept in the way that relationships are handled.  I come from a SQL background, so this data model seems pretty straight forward to me, however it bre...
  • mhossain's avatar
    mhossain
    6 years ago

    Nemza 

     

    Creating bridging table automatically:

     

    1. Go to 'Modeling' tab in your pbi and click 'New Table'

     

    2. write dax, I am assuming, your all tables names like, Table1, table2, Table3 and so on........ and ID field name is 'id'

     

    UniqueAllids =
    DISTINCT(

    UNION(

    SELECTCOLUMNS(Table1,"id",Table1[id]),
    SELECTCOLUMNS(Table2,"id",Table2[id]),
    SELECTCOLUMNS(Table3,"id",Table3[id])
    ))

     

    3. Now you have all the unique IDs from all the tables, and try the relationship to all the tables, on the visual, drag fields from this table, so you can bring more fields to this table, above dax is just an example of one field, you can add more fields to this.

     

    Let me know if you face any challenges.