Forum Discussion

hidenseek9's avatar
hidenseek9
Post Patron
9 years ago
Solved

Cannot create relationships

Hi Power BI Community!   I need help from you on creating relationships between data. I am working on multiple excel files in power BI and I want to create relationships with one another. I am tr...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi hidenseek9,

    When creating relationship using your sample data, I get the following error message, as the message mentions, one of the columns you use to create relationship must have unique values.


    In your scenario, you can remove duplicates(20191666) in your MasterFile as shown in the following screenshot, then create replication between the two tables.


    If you want to reserve duplicates in MasterFile, please create another new table using the following DAX(replace table name with your own), then create relationship between the new table and MasterFile, and create relationship between the new table and actual data file.

    NewTable = 
    FILTER(
    DISTINCT(
    UNION(
    DISTINCT(Sheet2[#]),
    DISTINCT(Sheet3[Vendor])
    )
    ),
    NOT(ISBLANK(Sheet2[#]))
    )



    Thanks,
    Lydia Zhang

  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi hidenseek9,


    Do you use the "Remove Duplicates" option I mentioned in the second screenshot to remove duplicates?  If so, you should be able to create relationship between original tables. "Remove Duplicates" option is available in Query Editor of Power BI Desktop.

    Thanks,
    Lydia Zhang