Forum Discussion
Calculation DAX
- Anonymous1 year ago
Hi nesrinehal20
Please try the following possible solutions:
1. First, create the following measures to calculate total actual cost and pmp.
TotalActualCost = CALCULATE( SUM('OF'[actual cost]), ALLEXCEPT('OF', 'OF'[num_of]) )TotalPMP = CALCULATE( SUMX( 'OF', RELATED('PURCHASE'[pmp]) ), ALLEXCEPT('OF', 'OF'[num_of]) )2. Create the following measures to calculate consumption and material cost.
consumption = [TotalActualCost] * [TotalPMP]material cost = DIVIDE( [consumption], CALCULATE( SUM('PF'[quantity]), ALLEXCEPT('PF', 'PF'[num_of]) ) )Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ok done but if the same item has several real cost and pmp values and I must add them before multiplying them how to do it
Hi nesrinehal20
Please try the following possible solutions:
1. First, create the following measures to calculate total actual cost and pmp.
TotalActualCost =
CALCULATE(
SUM('OF'[actual cost]),
ALLEXCEPT('OF', 'OF'[num_of])
)TotalPMP =
CALCULATE(
SUMX(
'OF',
RELATED('PURCHASE'[pmp])
),
ALLEXCEPT('OF', 'OF'[num_of])
)
2. Create the following measures to calculate consumption and material cost.
consumption = [TotalActualCost] * [TotalPMP]material cost =
DIVIDE(
[consumption],
CALCULATE(
SUM('PF'[quantity]),
ALLEXCEPT('PF', 'PF'[num_of])
)
)
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.