Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I am attempting to calculate the % of the material cost of a part based on the overall material cost of all parts in a given location. I assumed it would be straightforward with <single part cost>/<overall cost> but I am having trouble getting the denominator using Calculate and All functions, can anyone tell me what I am doing wrong?
I have one table with sales orders like so:
| Warehouse | PartId | Invoice | Date | RepId | CustomerId | Sale Amt | Qty | |||||||
| 1 | 359 | 112 | 1/6/2023 | 1 | 878 | $6,453.10 | 1 | |||||||
| 2 | 372 | 113 | 1/6/2023 | 2 | 878 | $19,327.44 | 1 |
I have several other dimension tables connected to this, but most importantly I have a Part table with associated costs that is linked in a Many to 1 relationship to the Sales Order table:
| PartId | Unit Cost | |
| 359 | $5,150 | |
| 372 | $15,500 |
First I create a measure for the cost unit cost: UnitCost = sumx('Part Table','Part Table'[Unit Cost]).
I also create a Qty measure just for convencience: OrderQty = sumx('Sales Orders','Sales Orders'[Qty])
Then I calculate the material cost for the order by multiplying Qty * Cost but I need to do some extra DAX in order to ensure that it multiplies and then sums (it was giving me incorrect totals because it was summing and then multiplying when I did [UnitCost] * [OrderQty]).
The ExtCost measure:
Solved! Go to Solution.
Use ALLSELECTED('Sales Orders') or REMOVEFILTERS() on the warehouse column.
Use ALLSELECTED('Sales Orders') or REMOVEFILTERS() on the warehouse column.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |