Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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'm sure this is possible, but I haven't been able to make it work yet. The particular problem I'm seeing is forcing the correct order of operations in the Measure. I have tried using SUMMARIZE inside the measure to pre-aggregate the calculations as well as also working from the Quick Measure Weighted average, but I've not been able to make either method work.
The desired result is like in the Excel screenshot below:
1-Jan | Line1 | A | 25 | 25 | |
1-Jan | Line1 | B | 23 | 26 | |
1-Jan | Line1 | C | 20 | 25 | TRUE |
2-Jan | Line1 | A | 20 | 25 | |
2-Jan | Line1 | B | 23 | 25 | |
2-Jan | Line1 | C | 24 | 24 | TRUE |
1-Jan | Line2 | A | 23 | 27 | |
1-Jan | Line2 | B | 23 | 26 | |
1-Jan | Line2 | C | 20 | 24 | TRUE |
2-Jan | Line2 | A | 20 | 25 | |
2-Jan | Line2 | B | 23 | 26 | |
2-Jan | Line2 | C | 21 | 23 | TRUE |
Solved! Go to Solution.
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])
)
)
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])
)
)
@wallace13 , How you have done calculations for I, J, and K are very clear. can you explain with an example
I've added the formula examples now. Thanks!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
44 | |
32 | |
30 | |
18 | |
17 |