Forum Discussion

qpr4leyf's avatar
qpr4leyf
Frequent Visitor
2 years ago
Solved

Managing relationships between two data sources

Hi,   I am new to PowerBI and I'm struggling, despite watching several tutorials. The tutorials generally are trouble free because they demo very simple dataset relationships. I am basically after ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi qpr4leyf ,

     

    If you encounter a many-to-many relationship warning, it means that there are non-unique values in the column you are trying to join. This occurs when you have multiple data for the same date/country.

     

    Consider creating a date dimension table to resolve this.

     

    Please follow these steps:

     

    1. Here's the example data I created:

    Date of Purchase

    Country

    CustomerID

    1/1/2024

    A

    a1

    2/1/2024

    B

    a2

    3/1/2024

    C

    a3

    4/1/2024

    D

    a4

    5/1/2024

    E

    a5

    1/1/2024

    A

    a6

    4/1/2024

    B

    a7

    1/1/2024

    C

    a8

    4/1/2024

    D

    a9

    4/1/2024

    E

    a10

     

    Date of Purchase

    Country

    Sales

    1/1/2024

    A

    100

    2/1/2024

    B

    200

    3/1/2024

    C

    300

    4/1/2024

    D

    400

    5/1/2024

    E

    500

    1/1/2024

    A

    100

    2/1/2024

    B

    200

    3/1/2024

    C

    300

    4/1/2024

    D

    400

    5/1/2024

    E

    500

     

    2. Create a date table:

    Date = CALENDAR(MIN('Table'[Date of Purchase]),MAX('Table'[Date of Purchase]))

     

    3. Building Relationships:

     

    4. Drag to the chart for display:

     

    5. The final page effect is as follows:

     

    If you have any other questions please feel free to contact me.

     

    The pbix file is attached.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi qpr4leyf ,

     

    When there are no unique values ​​in either table, *:* will be displayed after the relationship is established.

     

    At this time, it is best to create a dimension table, such as the date dimension table in my reply.

     

    Establish a relationship between the fact table and the dimension table. Since the date column in the date dimension table is unique, it is used as a connecting field to establish a relationship with the two tables. At this time, the most ideal 1:* relationship is established.

     

    If you want to learn more about fact tables and dimension tables, please refer to:

    How to Create Fact and Dimension Tables in Power BI - Zebra BI

     

    If you have any other questions please feel free to contact me.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!