Forum Discussion
Anonymous
5 years agoNot applicable
Easy Sum Based on Dates Current/Previous Question
I have a Table with two columns - month, a #. I am trying to make a third calculated column that adds the current month with the lines above it to get a total. ex:
| Month | Number | NumberYTD |
| 7/1/2020 | 23 | 23 |
| 8/1/2020 | 21 | 44 |
| 9/1/2020 | 22 | 66 |
| 10/1/2020 | 22 | 88 |
| 11/1/2020 | 21 | 109 |
| 12/1/2020 | 23 | 132 |
| 1/1/2021 | 21 | 153 |
| 2/1/2021 | 20 | 173 |
| 3/1/2021 | 23 | 196 |
I tried:
NumerYTD = calculate(sum(Table[Number]),Filter(Table,Table[Month]<=Table[Month]))
but that just gives me 196 for every line.
TYIA
Anonymous ,
Try this code for a new calculated column:
Number YTD = CALCULATE(SUM('Table'[Number]), FILTER('Table', 'Table'[Month] <= EARLIER('Table'[Month])))
1 Reply
- camargos88
Community Champion
Anonymous ,
Try this code for a new calculated column:
Number YTD = CALCULATE(SUM('Table'[Number]), FILTER('Table', 'Table'[Month] <= EARLIER('Table'[Month])))