I have a DAX measure where i need to sum up all quantities started for a particular drawing number.
First i determine the lowest (minimum) seq no for a production order (Order) linked to a specific Drawing No, the image below shows this.
The DAX measure for Min Seq No is as follows
Min Seq No = MIN( 'Production'[Seq No])
I then determine what the Maximum quantity that has started for a particular Production order and Seq no.
The DAX measure for Seq No Max Qty is
Seq No Max Qty =
VAR _SeqNo =
CALCULATE(
MIN ( 'Production'[Seq No]) ,
ALLEXCEPT('Production', 'Production'[Drawing No] , 'Production'[Order] )
)
RETURN
CALCULATE(
MAX( 'Production'[Op Qty] ) ,
FILTER (
ALLEXCEPT( 'Production' , 'Production'[Drawing No] , 'Production'[Order]) ,
'Production'[Seq No] = _SeqNo
)
)
The DAX measure appears to be returning the correct result. Although curiously the Total row is only showing a total of 52, any thoughts why?
When i now want to reduce the context to just Drawing Number only i do not get the desired result
The DAX measure for Seq No Sum Qty is…
Seq No Sum Qty =
VAR _SeqNo =
CALCULATE(
MIN ( 'Production'[Seq No]) ,
ALLEXCEPT('Production', 'Production'[Drawing No] , 'Production'[Order] )
)
RETURN
CALCULATE(
SUM( 'Production'[Op Qty] ) ,
FILTER (
ALLEXCEPT( 'Production' , 'Production'[Drawing No] , 'Production'[Order]) ,
'Production'[Seq No] = _SeqNo
)
)
For the DAX measure Seq No Sum Qty on Drawing Number B6320719 returns 299, where using DAX measuren Seq No Max Qty for same Drawing number sums up to 349
I have also provided a sample pbix and the excel file
What am i doing wrong, any help would be greatly appreciated?
Many thanks
J
Production Rev-1.pbix (115.5 KB)
Production Rev-1.xlsx (431.5 KB)