Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
I am trying to calculate the total quantity of items on all lines of an order.
So each line will show the quantity for the orderline, and the total order quantity.
Model is simple, an order dimension and a fact table at the orderline granularity.
Heres where i have gotten to. I want to see each order line, but with a measure that shows the total sum quantity for that order.
I created TO2 to give the orderTotal. The issue with the measure is:
I am aware that making the relationship bidirectional will fix the issue, but my actual model is quite complex and i dont want to use bidirectional relationships as i dont need ambiguity issues.
Im also aware that using the orderID from a dimension table makes things more difficult, but this is how it appears in the model.
Appreciate help understanding what i am doing wrong here.
A pbix is at this link
@wilson_smyth i looked at your pbix but not fully clear about your requirement, can you put what your expected result is based on pbix you shared and where you see the issue?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
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] ) )
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!
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
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.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
72 | |
67 | |
64 | |
42 | |
42 |
User | Count |
---|---|
46 | |
38 | |
28 | |
26 | |
25 |