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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sivakumar8
New Member

issue regarding relationship beween two tables

suppose i had a two tables like below

table1:                                                                 table2:

customer id  sales  date                                    customer id  quantity  date

cus1              100    1/1/17                                 cus1              2            1/1/17

cus1              200     1/1/17                                cus1             3              1/1/17

cus1              500     2/1/17                                 cus1               5            2/1/17

cus1              2000    3/1/17                                cus1            12            3/1/17

cus2             1000     5/1/17                                cus2           9                5/1/17

cus2             250       4/1/17                                cus2          7                  4/1/17

cus2             2500     7/1/17                                 cus2          8                 7/1/17

 

when i trying to establish a relationship its throwing an error like u have to make unique values 

please help me how to make relation between these two tables without  disturbing the original data

 

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

Hi @sivakumar8

 

The question is, why do you want to create a relationship?  I'm guessing so you can create visuals using Sales and Quantity.

 

Power BI will only support 1 to many relationships (or 1 to 1), which is why this isn't working.

 

However, if you create a Customer table that contains 1 row per customer  eg

 

CustomerID
-------------
Cus1
Cus2
...

Then you can create a relationship between your two existing tables and this new one.  You can then filter/slice and use the field from this axis in your visuals..

 

Repeat the same for the date.  A good starting point for dates is to create a new DAX table like this

 

Dates = CALENDARAUTO()

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Employee
Employee

Hi @sivakumar8

 

The question is, why do you want to create a relationship?  I'm guessing so you can create visuals using Sales and Quantity.

 

Power BI will only support 1 to many relationships (or 1 to 1), which is why this isn't working.

 

However, if you create a Customer table that contains 1 row per customer  eg

 

CustomerID
-------------
Cus1
Cus2
...

Then you can create a relationship between your two existing tables and this new one.  You can then filter/slice and use the field from this axis in your visuals..

 

Repeat the same for the date.  A good starting point for dates is to create a new DAX table like this

 

Dates = CALENDARAUTO()

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Just a note on the above.

 

If you have table with many customers you could always duplicate an existing table and remove any duplicates and uneeded columns. This will just speed up the entire process.

 

Hope it helps.

J

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.