Forum Discussion
Measure from data in one column
- 5 years ago
Oleg222
Can you try this version?Weighted Average = DIVIDE( SUMX( VALUES(Table3[Date]), CALCULATE( SUM(Table3[Value]), Table3[Measures] = "Efficiency1") * CALCULATE( SUM(Table3[Value]), Table3[Measures] = "Weight1") ) , SUMX( VALUES(Table3[Date]), CALCULATE( SUM(Table3[Value]), Table3[Measures] = "Weight1") ) )
Oleg222
Try this:
Weighted Average =
CALCULATE(
DIVIDE(
SUMX(
VALUES(Table3[Date]),
CALCULATE( SUM(Table3[Value]), Table3[Measures] = "Efficiency1") *
CALCULATE( SUM(Table3[Value]), Table3[Measures] = "Weight1")
)
,
SUMX(
VALUES(Table3[Date]),
CALCULATE( SUM(Table3[Value]), Table3[Measures] = "Weight1")
)
),
Table3[Value] <>0
)Fowmy unfortunately it doesn't work. For example - 09.06.2021 Efficiency1 = 0, Weight1 = 300. We remove all zeros with the filter. When counting, the value Weight1 = 300 is added to the denominator, but it shouldn't.
- Oleg2225 years agoHelper II
Fowmy sorry about that, below is the file in which everything is fixed. Considering that for 25.03, 28.03, 31.03 Efficiency is absent - Weight should not be added to the denominator (highlighted in red). In the table there are 3 options for the measure - the first (more complex but with the correct final result), the second (the best, in which we need to add a filter by dates where Efficiency is absent, the total is not correct) and the third (the second formula I corrected). I think my fixes can be done better.
https://drive.google.com/file/d/1QNNOtN4jmSF1E3qtk_w9YvNGPNYRnY0r/view?usp=sharing