My table has a column that calculates the cumulative total year-to-date (YTD). The column is Balance BRL. It works ok using the DAX function DATESYTD.
The column Balance BRL is perfectly achieved using the DAX below:
Balance BRL = 
CALCULATE (
    'Fact_balance_cash'[realized_application],
    DATESYTD('Calendar'[Date])
)
+
CALCULATE (
    'Fact_balance_cash'[realized_investiments],
    DATESYTD('Calendar'[Date])
)
+
CALCULATE (
    'Fact_balance_cash'[realized_balance],
    DATESYTD ('Calendar'[Date])
 )
+
CALCULATE (
    [Forecast_R],
    DATESYTD ( 'Calendar'[Date] )
)
I was asked to continue to accumulate the values over 2023. That is not compatible with the formula DATESYTD.
I read this article from daxpatterns.com: Link Cumulative Total
I tried to implement it. the result is -R$ 148.017.749,0527 which is indeed the final balance. But it seems the date does not take effect to properly calculate it by month.
My current measure is the one below. I am fixing the date period until the end of January in 2023 just to test:
Balance BRL = 
    var period_begin = DATE(2022,1,1)
    var period_end = DATE(2023,1,31)
return
CALCULATE (
    'Fact_balance_cash'[realized_application],
    'Calendar'[Date]<=period_end
)
+
CALCULATE (
    'Fact_balance_cash'[realized_investiments],
    'Calendar'[Date]<=period_end
)
+
CALCULATE (
    'Fact_balance_cash'[realized_balance],
    'Calendar'[Date]<=period_end
 )
+
CALCULATE (
    [Forecast_R],
    'Calendar'[Date]<=period_end
)
How to solve this cumulative total that continues to calculate from 2022 until 2023?

