The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 A | 10000 |
Component 1 | 500 |
Component 2 | 600 |
Main Device B | 15000 |
Component 3 | 1000 |
... |
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 1 | Main Device A | Bundle A |
Part 2 | Component 1 | Bundle A |
Part 3 | Component 2 | Bundle A |
Part 1 | Main Device B | Bundle B |
Part 2 | Component 1 | Bundle B |
Part 3 | Component 1 | Bundle B |
Part 4 | Component 3 | Bundle 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?
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)
Customer | Product | Revenue | Units |
A | Main Device A | 100 000 | 10 |
A | Component 1 | 10 000 | 20 |
A | Component 2 | 5 000 | 10 |
A | ... | .. | .. |
A | ... | ... | ... |
Try to smend [Price] as follows
Price =
SUMX ( Sales, DIVIDE ( Sales[Revenue], Sales[Qty] ) )
User | Count |
---|---|
11 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
10 | |
8 |