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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Lukas96
New Member

Many to many relationship calculation for groups of products

Hello guys,

I have this problem. I would like to calculate the bundle price and this is my model.

 

Sales table:

Product name Price

Main Device A10000
Component 1500
Component 2600
Main Device B15000
Component 31000
... 

and I have another table with Bundles which has Many to Many relationship with the table above on Product name = Product name

Parts Product name Bundle Name

Part 1Main Device ABundle A
Part 2Component 1Bundle A
Part 3Component 2Bundle A
Part 1Main Device BBundle B
Part 2Component 1Bundle B
Part 3Component 1Bundle B
Part 4Component 3Bundle B

 

What I want to achieve is to have a Price per Bundle Name. For example Bundle A price is the sum of each components: (Main Device A, Component 1, Component 2) 10000 + 500 + 600 = 11100
for Bundle B it is (Main Device B, Component 1 x2, Component 3) 15000 + 500 + 500 + 1000 = 17 000

I am a bit lost on what should be a DAX code for the price? 

 

3 REPLIES 3
Lukas96
New Member

This is simplified, I have a Price as a measure, what I have in the table sales is Revenue and Qty + I have Customers. Price is then a measure = Divide(Sum(revenue), Sum(Qty)). 
The measure itself is not working for Bundles because for Bundle A for example I dont want to aggregate all the componets within Bundle A. If I aggregate it the Price for Bundle A will be 2 900. But the correct price should be the sum of individual components prices (10 000 +500 + 600 = 11 000)

CustomerProductRevenueUnits
AMain Device A100 00010
AComponent 110 00020
AComponent 2 5 00010
A.......
A.........
 

@Lukas96 

Try to smend [Price] as follows 

Price =
SUMX ( Sales, DIVIDE ( Sales[Revenue], Sales[Qty] ) )

tamerj1
Super User
Super User

Hi @Lukas96 

have tried simple SUM ( Sales[Price] )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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