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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Combining tables on a non-unique column

I'm servicing machines in multiple cities, and need to know how many parts to order for each city based on expected usage. The complication is that some models use parts more frequently than others. So I have two tables:

 

Population

CityModelModel Count
MiamiModel A1
MiamiModel B2
JacksonvilleModel A4
JacksonvilleModel B3

 

Expected Usage

ModelPartExpected Annual Replacement
Model APart 12
Model APart 21
Model BPart 17
Model BPart 22

 

What I need is a result that tells me what to stock:

MiamiPart 116
MiamiPart 25
JacksonvillePart 129
JacksonvillePart 2

10

 

(For example Miami has just one of Model A, which uses two of Part 1 each year, and two of Model B, which uses seven of Part 1. So it needs two of Part 1 to service the Model As, and fourteen of Part 2 to service the Model Bs. So Miami needs a total of sixteen of Part 1.)

 

I could join these tables on the non-unique Model field. That would create duplication, which is what I want in this situation. But Power BI doesn't allow joins on non-unique fields. 

 

I could also create a relationship between each of these and a third table that's just "Model", but I can't seem to get that to work, either.

 

I'm open to doing this in different ways, so long as I end up with the result.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

You may refer to my solution here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

 

You may refer to my solution here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.