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
JoeThomas592
Frequent Visitor

Many to Many Relationship

 

I am modeling a Many to Many Relationship. Detail below, When I try to sum by ShippingCompanyId, I get the same Amount, How would I fix this?? We have a very complicated data mart, and have many of these similar scenarios.

 

 

 

I have attempted changing the many to many relationships, etc

 

ManyToMany.png

 

 

Sample Values:

create table dbo.DimCustomer
(
DimCustomerId int,
PersonName varchar(255)
)
insert into dbo.DimCustomer
values ('1','Joe'),
('2', 'Sally')

 

create table dbo.DimShippingCompany
(
DimShippingCompanyid int,
ShippingName varchar(255)
)
insert into dbo.DimShippingCompany
values ('1','UPS'),
('2', 'Fedex')


create table dbo.FactShipment
(
FactShipmentId int primary key,
DimCustomerId int,
DimShippingCompany int,
ShipmentQuantity int,
ShipmentTotal numeric(10,2)
)
insert into dbo.FactShipment
values (1,1,1,5,8),
(2,1,1,7,12),
(3,1,2,5,9),
(4,2,1,3,4),
(5,2,2,5,7)



create table dbo.FactOrder
(
FactOrderId int primary key identity(1,1),
DimCustomerId int,
OrderAmount numeric(10,2)
)

insert into dbo.FactOrder
values (1,50),
(1,28),
(2,41)

 

1 REPLY 1
synergised
Resolver II
Resolver II

google this:  Power BI multiple Fact Tables

 

There are a couple of videos on how to set things up when you use multiple fact tables. 

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.