Forum Discussion
Anonymous
4 years agoNot applicable
Weighted Average of RTY
Hi all, I've been trying to compute a weighted average of Roll Throughput Yield (RTY) using a DAX Measure, this would ideally compute at aggregations across multiple days and production lines. I...
- Anonymous4 years ago
I was ultimately able to determine the right function. You need to pre-calculate the table then group by and calculate. That will ensure the correct order of operations.
RTY Summary = var opSummary = SUMMARIZE( FTT ,[LINE],[OPERATIONNAME],[DATE],[Key Station] ,"FPY",DIVIDE(SUMX(FTT,[PASS]),SUMX(FTT,[TOTAL]),0) ,"TOTAL",sumx(ftt,[TOTAL]) ,"KEY_TOTAL",sumx(FILTER(ftt,[Key Station]=True),[TOTAL]) ) var lineSummary = GROUPBY(opSummary,[LINE],[DATE] ,"RTY",PRODUCTX(CURRENTGROUP(),[FPY]) ,"LINE_TOTAL",SUMX(CURRENTGROUP(),[KEY_TOTAL]) ) return CALCULATE( DIVIDE( SUMX(lineSummary,[RTY]*[LINE_TOTAL]), SUMX(lineSummary,[LINE_TOTAL]) ) )
Anonymous
4 years agoNot applicable
I was ultimately able to determine the right function. You need to pre-calculate the table then group by and calculate. That will ensure the correct order of operations.
RTY Summary =
var opSummary =
SUMMARIZE(
FTT
,[LINE],[OPERATIONNAME],[DATE],[Key Station]
,"FPY",DIVIDE(SUMX(FTT,[PASS]),SUMX(FTT,[TOTAL]),0)
,"TOTAL",sumx(ftt,[TOTAL])
,"KEY_TOTAL",sumx(FILTER(ftt,[Key Station]=True),[TOTAL])
)
var lineSummary =
GROUPBY(opSummary,[LINE],[DATE]
,"RTY",PRODUCTX(CURRENTGROUP(),[FPY])
,"LINE_TOTAL",SUMX(CURRENTGROUP(),[KEY_TOTAL])
)
return
CALCULATE(
DIVIDE(
SUMX(lineSummary,[RTY]*[LINE_TOTAL]),
SUMX(lineSummary,[LINE_TOTAL])
)
)