Forum Discussion
OscarSuarez10
Helper III
6 years agoAcumulated production
Hello I want to calculate the acumulated production per year, task and ID, like in the following table, can you help me?
| ID | TASK | YEAR | PRODUCTION | Accumulated production |
| 0 | 1 | 1 | -80 | -80 |
| 0 | 1 | 2 | 100 | 20 |
| 0 | 1 | 3 | 110 | 130 |
| 0 | 1 | 4 | 105 | 235 |
| 1 | 2 | 1 | -50 | -50 |
| 1 | 2 | 2 | -60 | -110 |
| 1 | 2 | 3 | -80 | -190 |
| 1 | 2 | 4 | 100 | -90 |
| 1 | 2 | 5 | 200 | 110 |
| 1 | 2 | 6 | 300 | 410 |
| 2 | 3 | 1 | -89 | -89 |
| 2 | 3 | 2 | -74 | -163 |
| 2 | 3 | 3 | -50 | -213 |
| 2 | 3 | 4 | -20 | -233 |
| 2 | 3 | 5 | 500 | 267 |
5 Replies
- AnonymousNot applicable
Hi,
modify below:
acumulated production =CALCULATE (sum("table name"[PRODUCTION]),FILTER (ALL ("TABLE NAME"[YEAR]),"TABLE NAME"[YEAR] <= MAX ( "TABLE NAME"[YEAR] )))thanksdaniel- OscarSuarez10
Helper III
Hello Anonymous , thanks for your help, when I use this formula I get the same values, is not adding the previus one:
YEAR PRODUCTION
Accumulated production1 -80 -80 2 100 100 3 110 110 4 105 105 1 -50 -50 2 -60 -60 3 -80 -80 4 100 100 5 200 200 6 300 300 1 -89 -89 2 -74 -74 3 -50 -50 4 -20 -20 5 500 500
- AnonymousNot applicable
Hi OscarSuarez10 ,
try the following expression:
var var_year = SELECTEDVALUE(table_name[YEAR])returnCALCULATE(sum(table_name[PRODUCTION]) ;Hoja1[YEAR]<= var_year)I think it is enough for your requeriment, good luck ;)- OscarSuarez10
Helper III
Hello Anonymous I applied the formula in this way:
ACUMULATED PRODUCTION =
var var_year = SELECTEDVALUE('pruebas'[YEAR])
return
CALCULATE(
sum('pruebas'[PRODUCTION]) ;
'pruebas'[YEAR]<= var_year
)
But i got nothin in the column:
Doy you know what am i doing wrong?
- AnonymousNot applicable
Hi OscarSuarez10 ,
I don't know what could happen. Check out the screenshot I attached, it may helps you: