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
tiberiomena
New Member

How to merge tables that have two keys

Hi guys, how are you?

 

I've been trying to merge two tables, but both of them have two keys. In SQL it's easy to do that with select * from... but it seems that Power BI can't.

 

This are my tables: A is a product sales (with date of sale), and B is service sales (with date of service). I want to merge these two tables since product service retentions depends on what product were sold. I attached a image for reference:

 

Two keys tables.PNG 

 

As you see, I want to know what sales and service were done monthly, by customer.

 

Please, your help will be greatly appreciated.

 

Regards,

 

Alexis

1 ACCEPTED SOLUTION
SivaMani
Resident Rockstar
Resident Rockstar

@tiberiomena,

 

As per your requirement,

  1. Generate Date table
  2. Dimension table for Vendor

Join the above table with TableA and TableB

 

Join.PNG

 

Merge.PNG

 

View solution in original post

2 REPLIES 2
SivaMani
Resident Rockstar
Resident Rockstar

@tiberiomena,

 

As per your requirement,

  1. Generate Date table
  2. Dimension table for Vendor

Join the above table with TableA and TableB

 

Join.PNG

 

Merge.PNG

 

Anonymous
Not applicable

Many-Many relationship is not supported in power BI. Hence you cannot merge Table A and table B. Instead you can try the alternate by having a master table for Vendor(i guess you are using the Vendor field to merge the two tables in SQL) 

1) Create a query in Power BI to get the distinct Vendor from Table A and table B and the name resulting table as VendorMaster

2)Create relationship within PowerBI VendorMAster->TableA and VendorMaster->TableB

Then you can create a measure to get the required result

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.