Issue With Totaling

I have a simple one-to-many relationship in my data model which can be seen in the photo. When i create a measure to find out the sale, cost and Gross margin value of each purchase I get the correct row value however the total value is very far off. Any Suggestions is great.

The Dax i use is - SUMX(IV_Product, IV_Product[Unit_Price]) * SUMX(IV_Product_Purchase_Detail, IV_Product_Purchase_Detail[Quantity])

i would upload more photos but it does not allow me to sorry - it gives me a result of 25billion which i know is far off

Hi Rob, I’m pretty sure it’s the formula here.

Can we try a formula like this and see if it improves it.

SUMX( [Detail table], RELATED( Product[Price]) * DetailTable[Quantity])

This simiplifies the formula. You’re doing quite a complex iteration within and iteration there which is a think why it’s playing up.

If this doesn’t work, coould you add an image of the results in a table in a reply message. Chrs

That works the trick. Thanks very much.