Forum Discussion
Running total average in matrix not working properly
- Anonymous1 year ago
Try this:
AVG Cost = VAR MinDate = MIN('ValTB'[Date]) VAR MaxDate = MAX('ValTB'[Date]) RETURN CALCULATE( DIVIDE( SUM(ValTB[Cost]), SUM(ValTB[Quant]), 0), FILTER( ALL(ValTB), ValTB[Date] >= MinDate && ValTB[Date] <= MaxDate ) )When you choose to check data for September, it ignores previous dates and only considers data for September.
If you're still having problems, provide some dummy data and the desired outcome. It is best presented in the form of a table.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Try this:
AVG Cost =
VAR MinDate = MIN('ValTB'[Date])
VAR MaxDate = MAX('ValTB'[Date])
RETURN
CALCULATE(
DIVIDE(
SUM(ValTB[Cost]),
SUM(ValTB[Quant]),
0),
FILTER(
ALL(ValTB),
ValTB[Date] >= MinDate &&
ValTB[Date] <= MaxDate
)
)
When you choose to check data for September, it ignores previous dates and only considers data for September.
If you're still having problems, provide some dummy data and the desired outcome. It is best presented in the form of a table.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.