Forum Discussion
calculate total quantity for each order
Apologies for the lack of clarity, I have updated the original post with a screenshot of the report & two points explaining the issue with it that i am stuck on.
Please let me know if there is enough information here as i can add whatever is required.
Thanks
This MEASURE works with your sample data.
Measure =
CALCULATE (
SUM ( Table1[Quantity] ),
ALL ( Table1[OrderLineID] ),
VALUES ( Table1[OrderID] )
)
- wilson_smyth7 years ago
Post Patron
thank you, this does work!
I need to understand it so that i learn from this.
Could I ask for an explaination how the dax engine interperts this measure?Thank you for your help!
- Zubair_Muhammad7 years ago
Community Champion
If you were using the Column OrderID from Table1, this simple measure would have sufficed
Measure = Calculate(sum(Table1[Quantity]),ALL(Table1[OrderLineID]))
i..e to you just wanted to sum for all Line IDs
but because you are using OrderID from Orders Table we needed to use VALUES(Table1[OrderID]) to hide the LineorderIDs which do not exist in Table1
- wilson_smyth7 years ago
Post Patron
Thanks zubair_Mumammad. I understand this, but as my mode works by filtering and slicing using dimensions, this makes Table1 the fact table and i cant store slicable attributes in the fact.
thsi is why i have a seperate orders dimension. but what i dont understand is, in the model i have, how the dax expression you wrote is interperted by the dax engine.