Problems with a YTD calculation
Hello.
I have three tables:
1. Movimientos, among others, with the following columns:
- date
- amt1
- amt2
- amt3
There may be multiple lines for the same date, with different amt values.
2. Calendar, the usual one, with the "date" column
3. Measures, with the following column (very simple!), among others, and working fine:
calc = Movimientos[amt1] + Movimientos [amt2] - Movimientos[amt3]
The tables "Movimientos" and "Calendar" have an active relationship, connecting the columns "date" and "date".
I made a simple table visual, with months in the rows and numbers and calc in values, like so:
| date | amt1 | amt2 | amt3 | calc |
| jan | 10 | 5 | 1 | 14 |
| feb | 20 | 6 | 11 | 15 |
| mar | 30 | 7 | 21 | 16 |
Until here, everything works fine.
What I need is the YTD of "calc", so I did a measure like the following:
calc YTD = TOTALYTD( calc, calendar[date] ).
Strangely, I obtained something like this:
| date | calc | calc YTD |
| jan | 14 | 14 |
| feb | 15 | 34 |
| mar | 16 | 64 |
So, the first month is OK. For the next month, it adds the first argument (amt1) of the "calc" formula, instead of adding the result of that formula. The same for the following months. Does this make sense?
Why is this happening?
Thank you and regards.